From be7688a0c84247850dc371f498932f0961ab2e06 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 25 Oct 2024 17:54:37 +0000 Subject: [PATCH] CodeGen from PR 30112 in Azure/azure-rest-api-specs Merge 28ebceadb670d9869cc686ae0ab1097affb24392 into 283930d97b13b4ef347a366035fcb8e9c6892f25 --- .../README.md | 7 +- .../_meta.json | 10 +- .../machinelearningservices/_configuration.py | 13 +- .../_machine_learning_services_mgmt_client.py | 239 +- .../machinelearningservices/_serialization.py | 118 +- .../mgmt/machinelearningservices/_vendor.py | 30 - .../mgmt/machinelearningservices/_version.py | 2 +- .../aio/_configuration.py | 13 +- .../_machine_learning_services_mgmt_client.py | 241 +- .../aio/operations/__init__.py | 70 +- .../_batch_deployments_operations.py | 288 +- .../operations/_batch_endpoints_operations.py | 311 +- .../_capability_hosts_operations.py | 474 + .../operations/_code_containers_operations.py | 115 +- .../operations/_code_versions_operations.py | 379 +- .../_component_containers_operations.py | 115 +- .../_component_versions_operations.py | 341 +- .../aio/operations/_compute_operations.py | 1187 +- .../aio/operations/_connection_operations.py | 786 + ...onnection_rai_blocklist_item_operations.py | 928 + ...nnection_rai_blocklist_items_operations.py | 161 + .../_connection_rai_blocklist_operations.py | 514 + .../_connection_rai_blocklists_operations.py | 155 + .../_connection_rai_policies_operations.py | 155 + .../_connection_rai_policy_operations.py | 508 + .../operations/_data_containers_operations.py | 115 +- .../operations/_data_versions_operations.py | 341 +- .../aio/operations/_datastores_operations.py | 225 +- .../_endpoint_deployment_operations.py | 714 + .../aio/operations/_endpoint_operations.py | 775 + .../_environment_containers_operations.py | 113 +- .../_environment_versions_operations.py | 341 +- .../aio/operations/_features_operations.py | 257 + .../_featureset_containers_operations.py | 599 + .../_featureset_versions_operations.py | 865 + ...aturestore_entity_containers_operations.py | 600 + ...featurestore_entity_versions_operations.py | 631 + .../_inference_endpoints_operations.py | 770 + .../_inference_groups_operations.py | 1591 + .../operations/_inference_pools_operations.py | 820 + .../aio/operations/_jobs_operations.py | 218 +- .../_managed_network_provisions_operations.py | 274 + ...anaged_network_settings_rule_operations.py | 560 + .../_marketplace_subscriptions_operations.py | 569 + .../_model_containers_operations.py | 115 +- .../operations/_model_versions_operations.py | 341 +- .../_online_deployments_operations.py | 349 +- .../_online_endpoints_operations.py | 416 +- .../aio/operations/_operations.py | 49 +- ...private_endpoint_connections_operations.py | 282 +- .../_private_link_resources_operations.py | 149 +- .../aio/operations/_quotas_operations.py | 77 +- .../operations/_rai_policies_operations.py | 155 + .../aio/operations/_rai_policy_operations.py | 504 + .../aio/operations/_registries_operations.py | 354 +- .../_registry_code_containers_operations.py | 200 +- .../_registry_code_versions_operations.py | 238 +- ...egistry_component_containers_operations.py | 200 +- ..._registry_component_versions_operations.py | 200 +- .../_registry_data_containers_operations.py | 200 +- .../_registry_data_references_operations.py | 216 + .../_registry_data_versions_operations.py | 238 +- ...istry_environment_containers_operations.py | 198 +- ...egistry_environment_versions_operations.py | 200 +- .../_registry_model_containers_operations.py | 200 +- .../_registry_model_versions_operations.py | 238 +- .../aio/operations/_schedules_operations.py | 208 +- .../_serverless_endpoints_operations.py | 1081 + .../aio/operations/_usages_operations.py | 39 +- .../_virtual_machine_sizes_operations.py | 34 +- .../_workspace_connections_operations.py | 777 +- .../_workspace_features_operations.py | 39 +- .../aio/operations/_workspaces_operations.py | 1627 +- .../models/__init__.py | 598 +- ...ine_learning_services_mgmt_client_enums.py | 1059 +- .../models/_models_py3.py | 36856 +++++++++++----- .../operations/__init__.py | 70 +- .../_batch_deployments_operations.py | 308 +- .../operations/_batch_endpoints_operations.py | 335 +- .../_capability_hosts_operations.py | 579 + .../operations/_code_containers_operations.py | 131 +- .../operations/_code_versions_operations.py | 440 +- .../_component_containers_operations.py | 131 +- .../_component_versions_operations.py | 396 +- .../operations/_compute_operations.py | 1488 +- .../operations/_connection_operations.py | 1055 + ...onnection_rai_blocklist_item_operations.py | 1186 + ...nnection_rai_blocklist_items_operations.py | 214 + .../_connection_rai_blocklist_operations.py | 662 + .../_connection_rai_blocklists_operations.py | 204 + .../_connection_rai_policies_operations.py | 204 + .../_connection_rai_policy_operations.py | 656 + .../operations/_data_containers_operations.py | 131 +- .../operations/_data_versions_operations.py | 396 +- .../operations/_datastores_operations.py | 248 +- .../_endpoint_deployment_operations.py | 938 + .../operations/_endpoint_operations.py | 1027 + .../_environment_containers_operations.py | 129 +- .../_environment_versions_operations.py | 396 +- .../operations/_features_operations.py | 369 + .../_featureset_containers_operations.py | 764 + .../_featureset_versions_operations.py | 1082 + ...aturestore_entity_containers_operations.py | 765 + ...featurestore_entity_versions_operations.py | 809 + .../_inference_endpoints_operations.py | 1005 + .../_inference_groups_operations.py | 1995 + .../operations/_inference_pools_operations.py | 1020 + .../operations/_jobs_operations.py | 241 +- .../_managed_network_provisions_operations.py | 315 + ...anaged_network_settings_rule_operations.py | 703 + .../_marketplace_subscriptions_operations.py | 711 + .../_model_containers_operations.py | 131 +- .../operations/_model_versions_operations.py | 396 +- .../_online_deployments_operations.py | 377 +- .../_online_endpoints_operations.py | 448 +- .../operations/_operations.py | 51 +- ...private_endpoint_connections_operations.py | 318 +- .../_private_link_resources_operations.py | 147 +- .../operations/_quotas_operations.py | 85 +- .../operations/_rai_policies_operations.py | 204 + .../operations/_rai_policy_operations.py | 656 + .../operations/_registries_operations.py | 382 +- .../_registry_code_containers_operations.py | 216 +- .../_registry_code_versions_operations.py | 260 +- ...egistry_component_containers_operations.py | 216 +- ..._registry_component_versions_operations.py | 216 +- .../_registry_data_containers_operations.py | 216 +- .../_registry_data_references_operations.py | 259 + .../_registry_data_versions_operations.py | 260 +- ...istry_environment_containers_operations.py | 214 +- ...egistry_environment_versions_operations.py | 216 +- .../_registry_model_containers_operations.py | 216 +- .../_registry_model_versions_operations.py | 260 +- .../operations/_schedules_operations.py | 224 +- .../_serverless_endpoints_operations.py | 1334 + .../operations/_usages_operations.py | 43 +- .../_virtual_machine_sizes_operations.py | 38 +- .../_workspace_connections_operations.py | 1047 +- .../_workspace_features_operations.py | 43 +- .../operations/_workspaces_operations.py | 1782 +- .../capability_host/create_or_update.py | 48 + .../capability_host/delete.py | 42 + .../generated_samples/capability_host/get.py | 43 + .../compute/create_or_update/aks_compute.py | 3 +- .../compute/create_or_update/aml_compute.py | 3 +- .../create_or_update/basic_aks_compute.py | 3 +- .../create_or_update/basic_aml_compute.py | 3 +- .../basic_data_factory_compute.py | 3 +- .../create_or_update/compute_instance.py | 37 +- .../compute_instance_minimal.py | 3 +- .../compute_instance_with_schedules.py | 3 +- .../create_or_update/kubernetes_compute.py | 3 +- .../generated_samples/compute/delete.py | 3 +- .../compute/get/aks_compute.py | 3 +- .../compute/get/aml_compute.py | 3 +- .../compute/get/compute_instance.py | 3 +- .../compute/get/kubernetes_compute.py | 3 +- .../get_allowed_vm_sizes_for_resize.py | 43 + .../generated_samples/compute/list.py | 3 +- .../generated_samples/compute/list_keys.py | 3 +- .../generated_samples/compute/list_nodes.py | 3 +- .../generated_samples/compute/patch.py | 3 +- .../generated_samples/compute/resize.py | 43 + .../generated_samples/compute/restart.py | 3 +- .../generated_samples/compute/start.py | 3 +- .../generated_samples/compute/stop.py | 3 +- .../compute/update_custom_services.py | 58 + .../compute/update_data_mounts.py | 52 + .../compute/update_idle_shutdown_setting.py | 43 + .../data_reference/get_blob_reference_sas.py | 45 + .../create_or_update.py | 3 +- .../create_or_update.py | 3 +- .../create_or_update.py | 3 +- .../create_or_update.py | 3 +- .../generated_samples/datastore/delete.py | 3 +- .../generated_samples/datastore/get.py | 3 +- .../generated_samples/datastore/list.py | 3 +- .../datastore/list_secrets.py | 3 +- .../generated_samples/endpoint/create.py | 50 + .../endpoint/deployment/create.py | 51 + .../endpoint/deployment/delete.py | 43 + .../endpoint/deployment/get.py | 44 + .../endpoint/deployment/get_deployments.py | 44 + .../endpoint/deployment/get_in_workspace.py | 43 + .../generated_samples/endpoint/get.py | 43 + .../generated_samples/endpoint/get_models.py | 44 + .../generated_samples/endpoint/list.py | 43 + .../generated_samples/endpoint/list_keys.py | 43 + .../endpoint/rai_policy/create.py | 62 + .../endpoint/rai_policy/delete.py | 43 + .../endpoint/rai_policy/get.py | 44 + .../endpoint/rai_policy/list.py | 44 + .../endpoint/regenerate_key.py | 44 + .../generated_samples/external_fqdn/get.py | 3 +- .../generated_samples/feature/get.py | 45 + .../generated_samples/feature/list.py | 45 + .../get_delta_models_status_async.py | 48 + .../list_delta_models_async.py | 50 + .../modify_delta_models_async.py | 48 + .../job/auto_ml_job/create_or_update.py | 3 +- .../generated_samples/job/auto_ml_job/get.py | 3 +- .../generated_samples/job/auto_ml_job/list.py | 3 +- .../generated_samples/job/cancel.py | 3 +- .../job/command_job/create_or_update.py | 3 +- .../generated_samples/job/command_job/get.py | 3 +- .../generated_samples/job/command_job/list.py | 3 +- .../generated_samples/job/delete.py | 3 +- .../job/fine_tuning_job/create_or_update.py | 76 + .../job/fine_tuning_job/get.py | 43 + .../job/fine_tuning_job/list.py | 43 + .../job/pipeline_job/create_or_update.py | 3 +- .../generated_samples/job/pipeline_job/get.py | 3 +- .../job/pipeline_job/list.py | 3 +- .../job/sweep_job/create_or_update.py | 3 +- .../generated_samples/job/sweep_job/get.py | 3 +- .../generated_samples/job/sweep_job/list.py | 3 +- .../managed_network/create_or_update_rule.py | 51 + .../managed_network/delete_rule.py | 42 + .../managed_network/get_rule.py | 43 + .../managed_network/list_rule.py | 43 + .../managed_network/provision.py | 42 + .../generated_samples/notebook/list_keys.py | 3 +- .../generated_samples/notebook/prepare.py | 3 +- .../online_deployment/get_logs.py | 3 +- .../create_or_update.py | 3 +- .../kubernetes_online_deployment/get.py | 3 +- .../kubernetes_online_deployment/list_skus.py | 3 +- .../kubernetes_online_deployment/update.py | 3 +- .../online_deployment/list.py | 3 +- .../create_or_update.py | 3 +- .../managed_online_deployment/get.py | 3 +- .../managed_online_deployment/list_skus.py | 3 +- .../managed_online_deployment/update.py | 3 +- .../create_or_update.py | 5 +- .../private_endpoint_connection/delete.py | 3 +- .../private_endpoint_connection/get.py | 3 +- .../private_endpoint_connection/list.py | 3 +- .../private_link_resource/list.py | 6 +- .../generated_samples/quota/list.py | 3 +- .../generated_samples/quota/update.py | 3 +- .../create_or_update_system_created.py | 3 +- .../create_or_update_user_created.py | 3 +- .../generated_samples/registries/delete.py | 3 +- .../registries/get_system_created.py | 3 +- .../registries/get_user_created.py | 3 +- .../registries/list_by_subscription.py | 3 +- .../registries/list_system_created.py | 3 +- .../registries/list_user_created.py | 3 +- .../registries/remove_regions.py | 3 +- .../registries/update_system_created.py | 3 +- .../registries/update_user_created.py | 3 +- .../code_container/create_or_update.py | 3 +- .../registry/code_container/delete.py | 3 +- .../registry/code_container/get.py | 3 +- .../registry/code_container/list.py | 3 +- .../create_or_get_start_pending_upload.py | 3 +- .../registry/code_version/create_or_update.py | 3 +- .../registry/code_version/delete.py | 3 +- .../registry/code_version/get.py | 3 +- .../registry/code_version/list.py | 3 +- .../component_container/create_or_update.py | 3 +- .../registry/component_container/delete.py | 3 +- .../registry/component_container/get.py | 3 +- .../registry/component_container/list.py | 3 +- .../component_version/create_or_update.py | 3 +- .../registry/component_version/delete.py | 3 +- .../registry/component_version/get.py | 3 +- .../registry/component_version/list.py | 3 +- .../data_container/create_or_update.py | 3 +- .../registry/data_container/delete.py | 3 +- .../registry/data_container/get.py | 3 +- .../registry/data_container/registry_list.py | 3 +- .../create_or_get_start_pending_upload.py | 3 +- .../data_version_base/create_or_update.py | 3 +- .../registry/data_version_base/delete.py | 3 +- .../registry/data_version_base/get.py | 3 +- .../data_version_base/registry_list.py | 3 +- .../model_container/create_or_update.py | 3 +- .../registry/model_container/delete.py | 3 +- .../registry/model_container/get.py | 3 +- .../registry/model_container/list.py | 3 +- .../create_or_get_start_pending_upload.py | 3 +- .../model_version/create_or_update.py | 3 +- .../registry/model_version/delete.py | 3 +- .../registry/model_version/get.py | 3 +- .../registry/model_version/list.py | 3 +- .../schedule/create_or_update.py | 3 +- .../generated_samples/schedule/delete.py | 3 +- .../generated_samples/schedule/get.py | 3 +- .../generated_samples/schedule/list.py | 3 +- .../generated_samples/usage/list.py | 3 +- .../virtual_machine_size/list.py | 3 +- .../batch_deployment/create_or_update.py | 3 +- .../workspace/batch_deployment/delete.py | 3 +- .../workspace/batch_deployment/get.py | 3 +- .../workspace/batch_deployment/list.py | 3 +- .../workspace/batch_deployment/update.py | 3 +- .../batch_endpoint/create_or_update.py | 3 +- .../workspace/batch_endpoint/delete.py | 3 +- .../workspace/batch_endpoint/get.py | 3 +- .../workspace/batch_endpoint/list.py | 3 +- .../workspace/batch_endpoint/list_keys.py | 3 +- .../workspace/batch_endpoint/update.py | 3 +- .../code_container/create_or_update.py | 3 +- .../workspace/code_container/delete.py | 3 +- .../workspace/code_container/get.py | 3 +- .../workspace/code_container/list.py | 3 +- .../create_or_get_start_pending_upload.py | 3 +- .../code_version/create_or_update.py | 3 +- .../workspace/code_version/delete.py | 3 +- .../workspace/code_version/get.py | 3 +- .../workspace/code_version/list.py | 3 +- .../workspace/code_version/publish.py | 44 + .../component_container/create_or_update.py | 3 +- .../workspace/component_container/delete.py | 3 +- .../workspace/component_container/get.py | 3 +- .../workspace/component_container/list.py | 3 +- .../component_version/create_or_update.py | 3 +- .../workspace/component_version/delete.py | 3 +- .../workspace/component_version/get.py | 3 +- .../workspace/component_version/list.py | 3 +- .../workspace/component_version/publish.py | 44 + .../generated_samples/workspace/create.py | 5 +- .../data_container/create_or_update.py | 3 +- .../workspace/data_container/delete.py | 3 +- .../workspace/data_container/get.py | 3 +- .../workspace/data_container/list.py | 3 +- .../data_version_base/create_or_update.py | 3 +- .../workspace/data_version_base/delete.py | 3 +- .../workspace/data_version_base/get.py | 3 +- .../workspace/data_version_base/list.py | 3 +- .../workspace/data_version_base/publish.py | 44 + .../generated_samples/workspace/delete.py | 3 +- .../generated_samples/workspace/diagnose.py | 3 +- .../featureset_container/create_or_update.py | 51 + .../workspace/featureset_container/delete.py | 42 + .../featureset_container/get_entity.py | 43 + .../workspace/featureset_container/list.py | 43 + .../workspace/featureset_version/backfill.py | 57 + .../featureset_version/create_or_update.py | 71 + .../workspace/featureset_version/delete.py | 43 + .../workspace/featureset_version/get.py | 44 + .../workspace/featureset_version/list.py | 44 + .../create_or_update.py | 51 + .../featurestore_entity_container/delete.py | 42 + .../get_entity.py | 43 + .../featurestore_entity_container/list.py | 43 + .../create_or_update.py | 54 + .../featurestore_entity_version/delete.py | 43 + .../featurestore_entity_version/get.py | 44 + .../featurestore_entity_version/list.py | 44 + .../generated_samples/workspace/get.py | 3 +- .../inference_endpoint/create_or_update.py | 58 + .../workspace/inference_endpoint/delete.py | 43 + .../workspace/inference_endpoint/get.py | 44 + .../workspace/inference_endpoint/list.py | 44 + .../workspace/inference_endpoint/update.py | 45 + .../inference_group/create_or_update.py | 83 + .../workspace/inference_group/delete.py | 43 + .../workspace/inference_group/get.py | 44 + .../workspace/inference_group/get_status.py | 44 + .../workspace/inference_group/list.py | 44 + .../workspace/inference_group/list_skus.py | 45 + .../workspace/inference_group/update.py | 48 + .../inference_pool/create_or_update.py | 55 + .../workspace/inference_pool/delete.py | 42 + .../workspace/inference_pool/get.py | 43 + .../workspace/inference_pool/list.py | 43 + .../workspace/inference_pool/update.py | 48 + .../workspace/list_by_resource_group.py | 3 +- .../workspace/list_by_subscription.py | 3 +- .../generated_samples/workspace/list_keys.py | 3 +- .../workspace/list_notebook_access_token.py | 3 +- .../workspace/list_storage_account_keys.py | 3 +- .../create_or_update.py | 44 + .../marketplace_subscription/delete.py | 42 + .../workspace/marketplace_subscription/get.py | 43 + .../marketplace_subscription/list.py | 43 + .../model_container/create_or_update.py | 3 +- .../workspace/model_container/delete.py | 3 +- .../workspace/model_container/get.py | 3 +- .../workspace/model_container/list.py | 3 +- .../model_version/create_or_update.py | 3 +- .../workspace/model_version/delete.py | 3 +- .../workspace/model_version/get.py | 3 +- .../workspace/model_version/list.py | 3 +- .../workspace/model_version/publish.py | 44 + .../workspace/online_deployment/delete.py | 3 +- .../online_endpoint/create_or_update.py | 3 +- .../workspace/online_endpoint/delete.py | 3 +- .../workspace/online_endpoint/get.py | 3 +- .../workspace/online_endpoint/get_token.py | 3 +- .../workspace/online_endpoint/list.py | 3 +- .../workspace/online_endpoint/list_keys.py | 3 +- .../online_endpoint/regenerate_keys.py | 3 +- .../workspace/online_endpoint/update.py | 3 +- .../workspace/operations_list.py | 3 +- .../workspace/resync_keys.py | 3 +- .../serverless_endpoint/create_or_update.py | 55 + .../workspace/serverless_endpoint/delete.py | 42 + .../workspace/serverless_endpoint/get.py | 43 + .../workspace/serverless_endpoint/list.py | 43 + .../serverless_endpoint/list_keys.py | 43 + .../serverless_endpoint/regenerate_keys.py | 44 + .../workspace/serverless_endpoint/update.py | 48 + .../generated_samples/workspace/update.py | 5 +- .../workspace_connection/create.py | 4 +- .../workspace_connection/create_deployment.py | 51 + .../workspace_connection/delete.py | 3 +- .../workspace_connection/delete_deployment.py | 43 + .../workspace_connection/get.py | 3 +- .../workspace_connection/get_deployment.py | 44 + .../workspace_connection/get_models.py | 44 + .../workspace_connection/list.py | 3 +- .../list_connection_models.py | 42 + .../workspace_connection/list_deployments.py | 44 + .../workspace_connection/list_secrets.py | 43 + .../rai_blocklist/create.py | 45 + .../rai_blocklist/delete.py | 43 + .../workspace_connection/rai_blocklist/get.py | 44 + .../rai_blocklist/list.py | 44 + .../rai_blocklist_item/add_bulk.py | 48 + .../rai_blocklist_item/create.py | 46 + .../rai_blocklist_item/delete.py | 44 + .../rai_blocklist_item/delete_bulk.py | 44 + .../rai_blocklist_item/get.py | 45 + .../rai_blocklist_item/list.py | 45 + .../workspace_connection/rai_policy/create.py | 62 + .../workspace_connection/rai_policy/delete.py | 43 + .../workspace_connection/rai_policy/get.py | 44 + .../workspace_connection/rai_policy/list.py | 44 + .../workspace_connection/test_connection.py | 42 + .../workspace_connection/update.py | 43 + .../workspace_feature/list.py | 3 +- .../generated_tests/conftest.py | 47 + ...vices_mgmt_batch_deployments_operations.py | 131 + ...mgmt_batch_deployments_operations_async.py | 138 + ...ervices_mgmt_batch_endpoints_operations.py | 130 + ...s_mgmt_batch_endpoints_operations_async.py | 137 + ...rvices_mgmt_capability_hosts_operations.py | 82 + ..._mgmt_capability_hosts_operations_async.py | 87 + ...ervices_mgmt_code_containers_operations.py | 92 + ...s_mgmt_code_containers_operations_async.py | 93 + ..._services_mgmt_code_versions_operations.py | 126 + ...ces_mgmt_code_versions_operations_async.py | 129 + ...es_mgmt_component_containers_operations.py | 92 + ...t_component_containers_operations_async.py | 93 + ...ices_mgmt_component_versions_operations.py | 111 + ...gmt_component_versions_operations_async.py | 114 + ...arning_services_mgmt_compute_operations.py | 284 + ..._services_mgmt_compute_operations_async.py | 299 + ...ing_services_mgmt_connection_operations.py | 113 + ...rvices_mgmt_connection_operations_async.py | 118 + ...onnection_rai_blocklist_item_operations.py | 108 + ...ion_rai_blocklist_item_operations_async.py | 117 + ...nnection_rai_blocklist_items_operations.py | 33 + ...on_rai_blocklist_items_operations_async.py | 34 + ...gmt_connection_rai_blocklist_operations.py | 75 + ...nnection_rai_blocklist_operations_async.py | 80 + ...mt_connection_rai_blocklists_operations.py | 32 + ...nection_rai_blocklists_operations_async.py | 33 + ...mgmt_connection_rai_policies_operations.py | 32 + ...onnection_rai_policies_operations_async.py | 33 + ...s_mgmt_connection_rai_policy_operations.py | 90 + ..._connection_rai_policy_operations_async.py | 95 + ...ervices_mgmt_data_containers_operations.py | 92 + ...s_mgmt_data_containers_operations_async.py | 93 + ..._services_mgmt_data_versions_operations.py | 103 + ...ces_mgmt_data_versions_operations_async.py | 106 + ...ing_services_mgmt_datastores_operations.py | 97 + ...rvices_mgmt_datastores_operations_async.py | 98 + ...ces_mgmt_endpoint_deployment_operations.py | 100 + ...mt_endpoint_deployment_operations_async.py | 105 + ...rning_services_mgmt_endpoint_operations.py | 111 + ...services_mgmt_endpoint_operations_async.py | 114 + ..._mgmt_environment_containers_operations.py | 92 + ...environment_containers_operations_async.py | 93 + ...es_mgmt_environment_versions_operations.py | 122 + ...t_environment_versions_operations_async.py | 125 + ...rning_services_mgmt_features_operations.py | 48 + ...services_mgmt_features_operations_async.py | 49 + ...s_mgmt_featureset_containers_operations.py | 92 + ..._featureset_containers_operations_async.py | 97 + ...ces_mgmt_featureset_versions_operations.py | 141 + ...mt_featureset_versions_operations_async.py | 148 + ...aturestore_entity_containers_operations.py | 92 + ...tore_entity_containers_operations_async.py | 97 + ...featurestore_entity_versions_operations.py | 97 + ...estore_entity_versions_operations_async.py | 102 + ...ces_mgmt_inference_endpoints_operations.py | 121 + ...mt_inference_endpoints_operations_async.py | 128 + ...rvices_mgmt_inference_groups_operations.py | 221 + ..._mgmt_inference_groups_operations_async.py | 230 + ...ervices_mgmt_inference_pools_operations.py | 117 + ...s_mgmt_inference_pools_operations_async.py | 124 + ..._learning_services_mgmt_jobs_operations.py | 97 + ...ing_services_mgmt_jobs_operations_async.py | 102 + ...t_managed_network_provisions_operations.py | 31 + ...ged_network_provisions_operations_async.py | 34 + ...anaged_network_settings_rule_operations.py | 84 + ..._network_settings_rule_operations_async.py | 89 + ...mt_marketplace_subscriptions_operations.py | 89 + ...ketplace_subscriptions_operations_async.py | 94 + ...rvices_mgmt_model_containers_operations.py | 92 + ..._mgmt_model_containers_operations_async.py | 93 + ...services_mgmt_model_versions_operations.py | 115 + ...es_mgmt_model_versions_operations_async.py | 118 + ...ices_mgmt_online_deployments_operations.py | 145 + ...gmt_online_deployments_operations_async.py | 152 + ...rvices_mgmt_online_endpoints_operations.py | 160 + ..._mgmt_online_endpoints_operations_async.py | 169 + ...chine_learning_services_mgmt_operations.py | 29 + ...learning_services_mgmt_operations_async.py | 30 + ...private_endpoint_connections_operations.py | 95 + ...e_endpoint_connections_operations_async.py | 96 + ..._mgmt_private_link_resources_operations.py | 31 + ...private_link_resources_operations_async.py | 32 + ...earning_services_mgmt_quotas_operations.py | 42 + ...g_services_mgmt_quotas_operations_async.py | 43 + ...g_services_mgmt_rai_policies_operations.py | 32 + ...ices_mgmt_rai_policies_operations_async.py | 33 + ...ing_services_mgmt_rai_policy_operations.py | 90 + ...rvices_mgmt_rai_policy_operations_async.py | 95 + ...ing_services_mgmt_registries_operations.py | 250 + ...rvices_mgmt_registries_operations_async.py | 257 + ...gmt_registry_code_containers_operations.py | 92 + ...gistry_code_containers_operations_async.py | 97 + ..._mgmt_registry_code_versions_operations.py | 111 + ...registry_code_versions_operations_async.py | 116 + ...egistry_component_containers_operations.py | 92 + ...y_component_containers_operations_async.py | 97 + ..._registry_component_versions_operations.py | 96 + ...try_component_versions_operations_async.py | 101 + ...gmt_registry_data_containers_operations.py | 92 + ...gistry_data_containers_operations_async.py | 97 + ...gmt_registry_data_references_operations.py | 34 + ...gistry_data_references_operations_async.py | 35 + ..._mgmt_registry_data_versions_operations.py | 103 + ...registry_data_versions_operations_async.py | 108 + ...istry_environment_containers_operations.py | 92 + ...environment_containers_operations_async.py | 97 + ...egistry_environment_versions_operations.py | 107 + ...y_environment_versions_operations_async.py | 112 + ...mt_registry_model_containers_operations.py | 92 + ...istry_model_containers_operations_async.py | 97 + ...mgmt_registry_model_versions_operations.py | 115 + ...egistry_model_versions_operations_async.py | 120 + ...ning_services_mgmt_schedules_operations.py | 93 + ...ervices_mgmt_schedules_operations_async.py | 98 + ...es_mgmt_serverless_endpoints_operations.py | 147 + ...t_serverless_endpoints_operations_async.py | 156 + ...earning_services_mgmt_usages_operations.py | 30 + ...g_services_mgmt_usages_operations_async.py | 31 + ...s_mgmt_virtual_machine_sizes_operations.py | 30 + ..._virtual_machine_sizes_operations_async.py | 31 + ...s_mgmt_workspace_connections_operations.py | 109 + ..._workspace_connections_operations_async.py | 112 + ...ices_mgmt_workspace_features_operations.py | 31 + ...gmt_workspace_features_operations_async.py | 32 + ...ing_services_mgmt_workspaces_operations.py | 364 + ...rvices_mgmt_workspaces_operations_async.py | 381 + .../setup.py | 86 +- 562 files changed, 91543 insertions(+), 23617 deletions(-) delete mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capability_hosts_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_item_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_items_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklists_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_deployment_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_features_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_groups_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_pools_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_provisions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_settings_rule_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_marketplace_subscriptions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_references_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_serverless_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capability_hosts_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_item_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_items_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklists_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_deployment_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_features_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_groups_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_pools_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_provisions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_settings_rule_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_marketplace_subscriptions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_references_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_serverless_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get_allowed_vm_sizes_for_resize.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/resize.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_custom_services.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_data_mounts.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_idle_shutdown_setting.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/data_reference/get_blob_reference_sas.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_deployments.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_in_workspace.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get_models.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list_keys.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/regenerate_key.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/get_delta_models_status_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/list_delta_models_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/modify_delta_models_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/create_or_update_rule.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/delete_rule.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/get_rule.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/list_rule.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/provision.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/publish.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/publish.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/publish.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/get_entity.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/backfill.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/get_entity.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get_status.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list_skus.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/publish.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/create_or_update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list_keys.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/regenerate_keys.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create_deployment.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete_deployment.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_deployment.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_models.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_connection_models.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_deployments.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_secrets.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/add_bulk.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete_bulk.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/create.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/delete.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/get.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/list.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/test_connection.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/update.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/conftest.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations_async.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations.py create mode 100644 sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations_async.py diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/README.md b/sdk/machinelearning/azure-mgmt-machinelearningservices/README.md index c32ea2fcf5e..0a57d775e49 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/README.md +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Machine Learning Services Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-machinelearningservices%2FREADME.png) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json index f4f9290aab9..a01acad4ca6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c7daa3d35baaaabece0dbc6f731eadbe426973b9", + "commit": "e986da2f3c8fd04e8eb22581af639f350e4aa350", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.4.12", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.19.0", + "@autorest/modelerfour@4.27.0" ], - "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.4.12 --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 --generate-test=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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.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 a128695e54f..9651ed6982e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MachineLearningServicesMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MachineLearningServicesMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ 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 "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-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: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2024-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-machinelearningservices/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( 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 690ca6db66e..7656eea04fe 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 @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import MachineLearningServicesMgmtClientConfiguration @@ -18,17 +21,38 @@ from .operations import ( BatchDeploymentsOperations, BatchEndpointsOperations, + CapabilityHostsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, + ConnectionOperations, + ConnectionRaiBlocklistItemOperations, + ConnectionRaiBlocklistItemsOperations, + ConnectionRaiBlocklistOperations, + ConnectionRaiBlocklistsOperations, + ConnectionRaiPoliciesOperations, + ConnectionRaiPolicyOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, + EndpointDeploymentOperations, + EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, + FeaturesOperations, + FeaturesetContainersOperations, + FeaturesetVersionsOperations, + FeaturestoreEntityContainersOperations, + FeaturestoreEntityVersionsOperations, + InferenceEndpointsOperations, + InferenceGroupsOperations, + InferencePoolsOperations, JobsOperations, + ManagedNetworkProvisionsOperations, + ManagedNetworkSettingsRuleOperations, + MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -37,18 +61,22 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, + RaiPoliciesOperations, + RaiPolicyOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, + RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, + ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, @@ -64,10 +92,6 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """These APIs allow end users to operate on Azure Machine Learning Workspace resources. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.machinelearningservices.operations.Operations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.machinelearningservices.operations.UsagesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations @@ -77,15 +101,6 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :vartype quotas: azure.mgmt.machinelearningservices.operations.QuotasOperations :ivar compute: ComputeOperations operations :vartype compute: azure.mgmt.machinelearningservices.operations.ComputeOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations - :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 @@ -104,6 +119,9 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar registry_data_versions: RegistryDataVersionsOperations operations :vartype registry_data_versions: azure.mgmt.machinelearningservices.operations.RegistryDataVersionsOperations + :ivar registry_data_references: RegistryDataReferencesOperations operations + :vartype registry_data_references: + azure.mgmt.machinelearningservices.operations.RegistryDataReferencesOperations :ivar registry_environment_containers: RegistryEnvironmentContainersOperations operations :vartype registry_environment_containers: azure.mgmt.machinelearningservices.operations.RegistryEnvironmentContainersOperations @@ -122,6 +140,9 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar batch_deployments: BatchDeploymentsOperations operations :vartype batch_deployments: azure.mgmt.machinelearningservices.operations.BatchDeploymentsOperations + :ivar capability_hosts: CapabilityHostsOperations operations + :vartype capability_hosts: + azure.mgmt.machinelearningservices.operations.CapabilityHostsOperations :ivar code_containers: CodeContainersOperations operations :vartype code_containers: azure.mgmt.machinelearningservices.operations.CodeContainersOperations @@ -146,8 +167,34 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar environment_versions: EnvironmentVersionsOperations operations :vartype environment_versions: azure.mgmt.machinelearningservices.operations.EnvironmentVersionsOperations + :ivar featureset_containers: FeaturesetContainersOperations operations + :vartype featureset_containers: + azure.mgmt.machinelearningservices.operations.FeaturesetContainersOperations + :ivar features: FeaturesOperations operations + :vartype features: azure.mgmt.machinelearningservices.operations.FeaturesOperations + :ivar featureset_versions: FeaturesetVersionsOperations operations + :vartype featureset_versions: + azure.mgmt.machinelearningservices.operations.FeaturesetVersionsOperations + :ivar featurestore_entity_containers: FeaturestoreEntityContainersOperations operations + :vartype featurestore_entity_containers: + azure.mgmt.machinelearningservices.operations.FeaturestoreEntityContainersOperations + :ivar featurestore_entity_versions: FeaturestoreEntityVersionsOperations operations + :vartype featurestore_entity_versions: + azure.mgmt.machinelearningservices.operations.FeaturestoreEntityVersionsOperations + :ivar inference_pools: InferencePoolsOperations operations + :vartype inference_pools: + azure.mgmt.machinelearningservices.operations.InferencePoolsOperations + :ivar inference_endpoints: InferenceEndpointsOperations operations + :vartype inference_endpoints: + azure.mgmt.machinelearningservices.operations.InferenceEndpointsOperations + :ivar inference_groups: InferenceGroupsOperations operations + :vartype inference_groups: + azure.mgmt.machinelearningservices.operations.InferenceGroupsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.machinelearningservices.operations.JobsOperations + :ivar marketplace_subscriptions: MarketplaceSubscriptionsOperations operations + :vartype marketplace_subscriptions: + azure.mgmt.machinelearningservices.operations.MarketplaceSubscriptionsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.operations.ModelContainersOperations @@ -161,19 +208,70 @@ 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 serverless_endpoints: ServerlessEndpointsOperations operations + :vartype serverless_endpoints: + azure.mgmt.machinelearningservices.operations.ServerlessEndpointsOperations :ivar registries: RegistriesOperations operations :vartype registries: azure.mgmt.machinelearningservices.operations.RegistriesOperations :ivar workspace_features: WorkspaceFeaturesOperations operations :vartype workspace_features: azure.mgmt.machinelearningservices.operations.WorkspaceFeaturesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.machinelearningservices.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.machinelearningservices.operations.WorkspacesOperations + :ivar workspace_connections: WorkspaceConnectionsOperations operations + :vartype workspace_connections: + azure.mgmt.machinelearningservices.operations.WorkspaceConnectionsOperations + :ivar connection: ConnectionOperations operations + :vartype connection: azure.mgmt.machinelearningservices.operations.ConnectionOperations + :ivar connection_rai_blocklists: ConnectionRaiBlocklistsOperations operations + :vartype connection_rai_blocklists: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistsOperations + :ivar connection_rai_blocklist: ConnectionRaiBlocklistOperations operations + :vartype connection_rai_blocklist: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistOperations + :ivar connection_rai_blocklist_item: ConnectionRaiBlocklistItemOperations operations + :vartype connection_rai_blocklist_item: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistItemOperations + :ivar connection_rai_blocklist_items: ConnectionRaiBlocklistItemsOperations operations + :vartype connection_rai_blocklist_items: + azure.mgmt.machinelearningservices.operations.ConnectionRaiBlocklistItemsOperations + :ivar connection_rai_policies: ConnectionRaiPoliciesOperations operations + :vartype connection_rai_policies: + azure.mgmt.machinelearningservices.operations.ConnectionRaiPoliciesOperations + :ivar connection_rai_policy: ConnectionRaiPolicyOperations operations + :vartype connection_rai_policy: + azure.mgmt.machinelearningservices.operations.ConnectionRaiPolicyOperations + :ivar endpoint_deployment: EndpointDeploymentOperations operations + :vartype endpoint_deployment: + azure.mgmt.machinelearningservices.operations.EndpointDeploymentOperations + :ivar endpoint: EndpointOperations operations + :vartype endpoint: azure.mgmt.machinelearningservices.operations.EndpointOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.machinelearningservices.operations.RaiPoliciesOperations + :ivar rai_policy: RaiPolicyOperations operations + :vartype rai_policy: azure.mgmt.machinelearningservices.operations.RaiPolicyOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.operations.ManagedNetworkSettingsRuleOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.machinelearningservices.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.machinelearningservices.operations.PrivateLinkResourcesOperations + :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations + :vartype managed_network_provisions: + azure.mgmt.machinelearningservices.operations.ManagedNetworkProvisionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :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 "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-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. @@ -189,29 +287,36 @@ def __init__( self._config = MachineLearningServicesMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self._config, self._serialize, self._deserialize ) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - 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 ) @@ -230,6 +335,9 @@ def __init__( self.registry_data_versions = RegistryDataVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.registry_data_references = RegistryDataReferencesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.registry_environment_containers = RegistryEnvironmentContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -246,6 +354,9 @@ def __init__( self.batch_deployments = BatchDeploymentsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.capability_hosts = CapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.code_containers = CodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) self.code_versions = CodeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) self.component_containers = ComponentContainersOperations( @@ -263,7 +374,30 @@ def __init__( self.environment_versions = EnvironmentVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.featureset_containers = FeaturesetContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.features = FeaturesOperations(self._client, self._config, self._serialize, self._deserialize) + self.featureset_versions = FeaturesetVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.featurestore_entity_containers = FeaturestoreEntityContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.featurestore_entity_versions = FeaturestoreEntityVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inference_pools = InferencePoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.inference_endpoints = InferenceEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inference_groups = InferenceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.marketplace_subscriptions = MarketplaceSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -275,12 +409,57 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.serverless_endpoints = ServerlessEndpointsOperations( + 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 ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_connections = WorkspaceConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklists = ConnectionRaiBlocklistsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist = ConnectionRaiBlocklistOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist_item = ConnectionRaiBlocklistItemOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist_items = ConnectionRaiBlocklistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_policies = ConnectionRaiPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_policy = ConnectionRaiPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint_deployment = EndpointDeploymentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint = EndpointOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policy = RaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_network_provisions = ManagedNetworkProvisionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -300,12 +479,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "MachineLearningServicesMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py index 842ae727fbb..8139854b97b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,9 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +290,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +335,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +346,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +385,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +410,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +440,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +556,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +644,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -662,12 +657,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -709,7 +705,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -729,6 +725,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -741,7 +738,9 @@ def query(self, name, data, data_type, **kwargs): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -749,10 +748,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -803,7 +800,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -823,7 +820,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -891,6 +888,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +902,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +954,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -983,7 +989,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1160,10 +1166,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1199,7 +1205,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1220,7 +1225,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1361,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1381,7 +1385,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1434,12 +1438,12 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1471,7 +1475,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1505,14 +1509,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1568,7 +1572,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1642,7 +1646,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1690,7 +1694,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1747,7 +1751,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1798,7 +1802,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1852,10 +1855,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1883,7 +1886,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1900,7 +1903,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1935,7 +1938,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1972,7 +1975,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1988,9 +1991,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py deleted file mode 100644 index bd0df84f531..00000000000 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) 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 2eda2078958..e5754a47ce6 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.0b2" +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 f012a758393..c680d247bbf 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 @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MachineLearningServicesMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MachineLearningServicesMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MachineLearningServicesMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ 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 "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-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: str = kwargs.pop("api_version", "2023-04-01") + api_version: str = kwargs.pop("api_version", "2024-10-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-machinelearningservices/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( 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 0240f80e876..88288ede068 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 @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -18,17 +21,38 @@ from .operations import ( BatchDeploymentsOperations, BatchEndpointsOperations, + CapabilityHostsOperations, CodeContainersOperations, CodeVersionsOperations, ComponentContainersOperations, ComponentVersionsOperations, ComputeOperations, + ConnectionOperations, + ConnectionRaiBlocklistItemOperations, + ConnectionRaiBlocklistItemsOperations, + ConnectionRaiBlocklistOperations, + ConnectionRaiBlocklistsOperations, + ConnectionRaiPoliciesOperations, + ConnectionRaiPolicyOperations, DataContainersOperations, DataVersionsOperations, DatastoresOperations, + EndpointDeploymentOperations, + EndpointOperations, EnvironmentContainersOperations, EnvironmentVersionsOperations, + FeaturesOperations, + FeaturesetContainersOperations, + FeaturesetVersionsOperations, + FeaturestoreEntityContainersOperations, + FeaturestoreEntityVersionsOperations, + InferenceEndpointsOperations, + InferenceGroupsOperations, + InferencePoolsOperations, JobsOperations, + ManagedNetworkProvisionsOperations, + ManagedNetworkSettingsRuleOperations, + MarketplaceSubscriptionsOperations, ModelContainersOperations, ModelVersionsOperations, OnlineDeploymentsOperations, @@ -37,18 +61,22 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QuotasOperations, + RaiPoliciesOperations, + RaiPolicyOperations, RegistriesOperations, RegistryCodeContainersOperations, RegistryCodeVersionsOperations, RegistryComponentContainersOperations, RegistryComponentVersionsOperations, RegistryDataContainersOperations, + RegistryDataReferencesOperations, RegistryDataVersionsOperations, RegistryEnvironmentContainersOperations, RegistryEnvironmentVersionsOperations, RegistryModelContainersOperations, RegistryModelVersionsOperations, SchedulesOperations, + ServerlessEndpointsOperations, UsagesOperations, VirtualMachineSizesOperations, WorkspaceConnectionsOperations, @@ -64,10 +92,6 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """These APIs allow end users to operate on Azure Machine Learning Workspace resources. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.machinelearningservices.aio.operations.Operations - :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: azure.mgmt.machinelearningservices.aio.operations.WorkspacesOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.machinelearningservices.aio.operations.UsagesOperations :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations @@ -77,15 +101,6 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :vartype quotas: azure.mgmt.machinelearningservices.aio.operations.QuotasOperations :ivar compute: ComputeOperations operations :vartype compute: azure.mgmt.machinelearningservices.aio.operations.ComputeOperations - :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: - azure.mgmt.machinelearningservices.aio.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.machinelearningservices.aio.operations.PrivateLinkResourcesOperations - :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 @@ -104,6 +119,9 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar registry_data_versions: RegistryDataVersionsOperations operations :vartype registry_data_versions: azure.mgmt.machinelearningservices.aio.operations.RegistryDataVersionsOperations + :ivar registry_data_references: RegistryDataReferencesOperations operations + :vartype registry_data_references: + azure.mgmt.machinelearningservices.aio.operations.RegistryDataReferencesOperations :ivar registry_environment_containers: RegistryEnvironmentContainersOperations operations :vartype registry_environment_containers: azure.mgmt.machinelearningservices.aio.operations.RegistryEnvironmentContainersOperations @@ -122,6 +140,9 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar batch_deployments: BatchDeploymentsOperations operations :vartype batch_deployments: azure.mgmt.machinelearningservices.aio.operations.BatchDeploymentsOperations + :ivar capability_hosts: CapabilityHostsOperations operations + :vartype capability_hosts: + azure.mgmt.machinelearningservices.aio.operations.CapabilityHostsOperations :ivar code_containers: CodeContainersOperations operations :vartype code_containers: azure.mgmt.machinelearningservices.aio.operations.CodeContainersOperations @@ -148,8 +169,34 @@ class MachineLearningServicesMgmtClient: # pylint: disable=client-accepts-api-v :ivar environment_versions: EnvironmentVersionsOperations operations :vartype environment_versions: azure.mgmt.machinelearningservices.aio.operations.EnvironmentVersionsOperations + :ivar featureset_containers: FeaturesetContainersOperations operations + :vartype featureset_containers: + azure.mgmt.machinelearningservices.aio.operations.FeaturesetContainersOperations + :ivar features: FeaturesOperations operations + :vartype features: azure.mgmt.machinelearningservices.aio.operations.FeaturesOperations + :ivar featureset_versions: FeaturesetVersionsOperations operations + :vartype featureset_versions: + azure.mgmt.machinelearningservices.aio.operations.FeaturesetVersionsOperations + :ivar featurestore_entity_containers: FeaturestoreEntityContainersOperations operations + :vartype featurestore_entity_containers: + azure.mgmt.machinelearningservices.aio.operations.FeaturestoreEntityContainersOperations + :ivar featurestore_entity_versions: FeaturestoreEntityVersionsOperations operations + :vartype featurestore_entity_versions: + azure.mgmt.machinelearningservices.aio.operations.FeaturestoreEntityVersionsOperations + :ivar inference_pools: InferencePoolsOperations operations + :vartype inference_pools: + azure.mgmt.machinelearningservices.aio.operations.InferencePoolsOperations + :ivar inference_endpoints: InferenceEndpointsOperations operations + :vartype inference_endpoints: + azure.mgmt.machinelearningservices.aio.operations.InferenceEndpointsOperations + :ivar inference_groups: InferenceGroupsOperations operations + :vartype inference_groups: + azure.mgmt.machinelearningservices.aio.operations.InferenceGroupsOperations :ivar jobs: JobsOperations operations :vartype jobs: azure.mgmt.machinelearningservices.aio.operations.JobsOperations + :ivar marketplace_subscriptions: MarketplaceSubscriptionsOperations operations + :vartype marketplace_subscriptions: + azure.mgmt.machinelearningservices.aio.operations.MarketplaceSubscriptionsOperations :ivar model_containers: ModelContainersOperations operations :vartype model_containers: azure.mgmt.machinelearningservices.aio.operations.ModelContainersOperations @@ -164,19 +211,70 @@ 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 serverless_endpoints: ServerlessEndpointsOperations operations + :vartype serverless_endpoints: + azure.mgmt.machinelearningservices.aio.operations.ServerlessEndpointsOperations :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 + :ivar operations: Operations operations + :vartype operations: azure.mgmt.machinelearningservices.aio.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: azure.mgmt.machinelearningservices.aio.operations.WorkspacesOperations + :ivar workspace_connections: WorkspaceConnectionsOperations operations + :vartype workspace_connections: + azure.mgmt.machinelearningservices.aio.operations.WorkspaceConnectionsOperations + :ivar connection: ConnectionOperations operations + :vartype connection: azure.mgmt.machinelearningservices.aio.operations.ConnectionOperations + :ivar connection_rai_blocklists: ConnectionRaiBlocklistsOperations operations + :vartype connection_rai_blocklists: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistsOperations + :ivar connection_rai_blocklist: ConnectionRaiBlocklistOperations operations + :vartype connection_rai_blocklist: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistOperations + :ivar connection_rai_blocklist_item: ConnectionRaiBlocklistItemOperations operations + :vartype connection_rai_blocklist_item: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistItemOperations + :ivar connection_rai_blocklist_items: ConnectionRaiBlocklistItemsOperations operations + :vartype connection_rai_blocklist_items: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiBlocklistItemsOperations + :ivar connection_rai_policies: ConnectionRaiPoliciesOperations operations + :vartype connection_rai_policies: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiPoliciesOperations + :ivar connection_rai_policy: ConnectionRaiPolicyOperations operations + :vartype connection_rai_policy: + azure.mgmt.machinelearningservices.aio.operations.ConnectionRaiPolicyOperations + :ivar endpoint_deployment: EndpointDeploymentOperations operations + :vartype endpoint_deployment: + azure.mgmt.machinelearningservices.aio.operations.EndpointDeploymentOperations + :ivar endpoint: EndpointOperations operations + :vartype endpoint: azure.mgmt.machinelearningservices.aio.operations.EndpointOperations + :ivar rai_policies: RaiPoliciesOperations operations + :vartype rai_policies: azure.mgmt.machinelearningservices.aio.operations.RaiPoliciesOperations + :ivar rai_policy: RaiPolicyOperations operations + :vartype rai_policy: azure.mgmt.machinelearningservices.aio.operations.RaiPolicyOperations + :ivar managed_network_settings_rule: ManagedNetworkSettingsRuleOperations operations + :vartype managed_network_settings_rule: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkSettingsRuleOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.machinelearningservices.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.machinelearningservices.aio.operations.PrivateLinkResourcesOperations + :ivar managed_network_provisions: ManagedNetworkProvisionsOperations operations + :vartype managed_network_provisions: + azure.mgmt.machinelearningservices.aio.operations.ManagedNetworkProvisionsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :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 "2023-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-10-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. @@ -192,29 +290,36 @@ def __init__( self._config = MachineLearningServicesMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.virtual_machine_sizes = VirtualMachineSizesOperations( self._client, self._config, self._serialize, self._deserialize ) self.quotas = QuotasOperations(self._client, self._config, self._serialize, self._deserialize) self.compute = ComputeOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize - ) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) - 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 ) @@ -233,6 +338,9 @@ def __init__( self.registry_data_versions = RegistryDataVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.registry_data_references = RegistryDataReferencesOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.registry_environment_containers = RegistryEnvironmentContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -249,6 +357,9 @@ def __init__( self.batch_deployments = BatchDeploymentsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.capability_hosts = CapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.code_containers = CodeContainersOperations(self._client, self._config, self._serialize, self._deserialize) self.code_versions = CodeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) self.component_containers = ComponentContainersOperations( @@ -266,7 +377,30 @@ def __init__( self.environment_versions = EnvironmentVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.featureset_containers = FeaturesetContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.features = FeaturesOperations(self._client, self._config, self._serialize, self._deserialize) + self.featureset_versions = FeaturesetVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.featurestore_entity_containers = FeaturestoreEntityContainersOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.featurestore_entity_versions = FeaturestoreEntityVersionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inference_pools = InferencePoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.inference_endpoints = InferenceEndpointsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.inference_groups = InferenceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) + self.marketplace_subscriptions = MarketplaceSubscriptionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.model_containers = ModelContainersOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -278,12 +412,59 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.schedules = SchedulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.serverless_endpoints = ServerlessEndpointsOperations( + 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 ) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_connections = WorkspaceConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection = ConnectionOperations(self._client, self._config, self._serialize, self._deserialize) + self.connection_rai_blocklists = ConnectionRaiBlocklistsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist = ConnectionRaiBlocklistOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist_item = ConnectionRaiBlocklistItemOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_blocklist_items = ConnectionRaiBlocklistItemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_policies = ConnectionRaiPoliciesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.connection_rai_policy = ConnectionRaiPolicyOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint_deployment = EndpointDeploymentOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.endpoint = EndpointOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policies = RaiPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.rai_policy = RaiPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_network_settings_rule = ManagedNetworkSettingsRuleOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_network_provisions = ManagedNetworkProvisionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -303,12 +484,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MachineLearningServicesMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self 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 4967e3af693..0137d6511d4 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 @@ -6,27 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations from ._usages_operations import UsagesOperations from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations from ._quotas_operations import QuotasOperations from ._compute_operations import ComputeOperations -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_data_containers_operations import RegistryDataContainersOperations from ._registry_data_versions_operations import RegistryDataVersionsOperations +from ._registry_data_references_operations import RegistryDataReferencesOperations 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 ._capability_hosts_operations import CapabilityHostsOperations from ._code_containers_operations import CodeContainersOperations from ._code_versions_operations import CodeVersionsOperations from ._component_containers_operations import ComponentContainersOperations @@ -36,41 +33,66 @@ from ._datastores_operations import DatastoresOperations from ._environment_containers_operations import EnvironmentContainersOperations from ._environment_versions_operations import EnvironmentVersionsOperations +from ._featureset_containers_operations import FeaturesetContainersOperations +from ._features_operations import FeaturesOperations +from ._featureset_versions_operations import FeaturesetVersionsOperations +from ._featurestore_entity_containers_operations import FeaturestoreEntityContainersOperations +from ._featurestore_entity_versions_operations import FeaturestoreEntityVersionsOperations +from ._inference_pools_operations import InferencePoolsOperations +from ._inference_endpoints_operations import InferenceEndpointsOperations +from ._inference_groups_operations import InferenceGroupsOperations from ._jobs_operations import JobsOperations +from ._marketplace_subscriptions_operations import MarketplaceSubscriptionsOperations 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 ._serverless_endpoints_operations import ServerlessEndpointsOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._connection_operations import ConnectionOperations +from ._connection_rai_blocklists_operations import ConnectionRaiBlocklistsOperations +from ._connection_rai_blocklist_operations import ConnectionRaiBlocklistOperations +from ._connection_rai_blocklist_item_operations import ConnectionRaiBlocklistItemOperations +from ._connection_rai_blocklist_items_operations import ConnectionRaiBlocklistItemsOperations +from ._connection_rai_policies_operations import ConnectionRaiPoliciesOperations +from ._connection_rai_policy_operations import ConnectionRaiPolicyOperations +from ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_policy_operations import RaiPolicyOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", - "WorkspacesOperations", "UsagesOperations", "VirtualMachineSizesOperations", "QuotasOperations", "ComputeOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "WorkspaceConnectionsOperations", "RegistryCodeContainersOperations", "RegistryCodeVersionsOperations", "RegistryComponentContainersOperations", "RegistryComponentVersionsOperations", "RegistryDataContainersOperations", "RegistryDataVersionsOperations", + "RegistryDataReferencesOperations", "RegistryEnvironmentContainersOperations", "RegistryEnvironmentVersionsOperations", "RegistryModelContainersOperations", "RegistryModelVersionsOperations", "BatchEndpointsOperations", "BatchDeploymentsOperations", + "CapabilityHostsOperations", "CodeContainersOperations", "CodeVersionsOperations", "ComponentContainersOperations", @@ -80,14 +102,42 @@ "DatastoresOperations", "EnvironmentContainersOperations", "EnvironmentVersionsOperations", + "FeaturesetContainersOperations", + "FeaturesOperations", + "FeaturesetVersionsOperations", + "FeaturestoreEntityContainersOperations", + "FeaturestoreEntityVersionsOperations", + "InferencePoolsOperations", + "InferenceEndpointsOperations", + "InferenceGroupsOperations", "JobsOperations", + "MarketplaceSubscriptionsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "ServerlessEndpointsOperations", "RegistriesOperations", "WorkspaceFeaturesOperations", + "Operations", + "WorkspacesOperations", + "WorkspaceConnectionsOperations", + "ConnectionOperations", + "ConnectionRaiBlocklistsOperations", + "ConnectionRaiBlocklistOperations", + "ConnectionRaiBlocklistItemOperations", + "ConnectionRaiBlocklistItemsOperations", + "ConnectionRaiPoliciesOperations", + "ConnectionRaiPolicyOperations", + "EndpointDeploymentOperations", + "EndpointOperations", + "RaiPoliciesOperations", + "RaiPolicyOperations", + "ManagedNetworkSettingsRuleOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ManagedNetworkProvisionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() 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 ad5a11aaff3..76af827555c 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._batch_deployments_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +40,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,6 @@ def list( :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 BatchDeployment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.BatchDeployment] @@ -102,7 +106,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +117,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -122,12 +126,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -139,13 +141,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("BatchDeploymentTrackedResourceArmPaginatedResult", pipeline_response) @@ -155,11 +156,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,14 +173,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,30 +188,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -227,12 +227,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -251,14 +251,6 @@ async def begin_delete( :type endpoint_name: str :param deployment_name: Inference deployment identifier. Required. :type deployment_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: @@ -272,7 +264,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -283,11 +275,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -298,17 +291,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -327,12 +316,11 @@ async def get( :type endpoint_name: str :param deployment_name: The identifier for the Batch deployments. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BatchDeployment or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.BatchDeployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,23 +334,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchDeployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,16 +358,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore async def _update_initial( self, @@ -389,10 +371,10 @@ async def _update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO], + body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BatchDeployment]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -405,7 +387,7 @@ async def _update_initial( api_version: str = 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.BatchDeployment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -415,7 +397,7 @@ async def _update_initial( else: _json = self._serialize.body(body, "PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -425,30 +407,29 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchDeployment", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -456,14 +437,12 @@ async def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -496,14 +475,6 @@ async def begin_update( :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 BatchDeployment or the result of cls(response) :rtype: @@ -518,7 +489,7 @@ async def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -537,18 +508,10 @@ async def begin_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchDeployment or the result of cls(response) :rtype: @@ -563,7 +526,7 @@ async def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO], + body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.BatchDeployment]: """Update a batch inference deployment (asynchronous). @@ -580,21 +543,11 @@ async def begin_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Is either a - PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties type or a IO type. Required. + PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties type or a IO[bytes] type. + Required. :type body: ~azure.mgmt.machinelearningservices.models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties - 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. + or IO[bytes] :return: An instance of AsyncLROPoller that returns either BatchDeployment or the result of cls(response) :rtype: @@ -624,12 +577,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -639,17 +593,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.BatchDeployment].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[_models.BatchDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _create_or_update_initial( self, @@ -657,10 +609,10 @@ async def _create_or_update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.BatchDeployment, IO], + body: Union[_models.BatchDeployment, IO[bytes]], **kwargs: Any - ) -> _models.BatchDeployment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +625,7 @@ async def _create_or_update_initial( api_version: str = 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.BatchDeployment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -683,7 +635,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "BatchDeployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -693,29 +645,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchDeployment", 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") @@ -724,17 +676,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } - @overload async def begin_create_or_update( self, @@ -765,14 +713,6 @@ async def begin_create_or_update( :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 BatchDeployment or the result of cls(response) :rtype: @@ -787,7 +727,7 @@ async def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -806,18 +746,10 @@ async def begin_create_or_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchDeployment or the result of cls(response) :rtype: @@ -832,7 +764,7 @@ async def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.BatchDeployment, IO], + body: Union[_models.BatchDeployment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.BatchDeployment]: """Creates/updates a batch inference deployment (asynchronous). @@ -849,19 +781,8 @@ async def begin_create_or_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Is either a BatchDeployment type or - a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.BatchDeployment 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. + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.BatchDeployment or IO[bytes] :return: An instance of AsyncLROPoller that returns either BatchDeployment or the result of cls(response) :rtype: @@ -891,12 +812,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -909,14 +831,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.BatchDeployment].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}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[_models.BatchDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 8105fa8ba7c..ac43d6da4da 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._batch_endpoints_operations import ( build_create_or_update_request, build_delete_request, @@ -40,6 +41,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,6 @@ def list( :type count: 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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -97,7 +101,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,19 +112,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, count=count, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -132,13 +134,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("BatchEndpointTrackedResourceArmPaginatedResult", pipeline_response) @@ -148,11 +149,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,14 +166,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,29 +181,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -219,12 +219,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -241,14 +241,6 @@ async def begin_delete( :type workspace_name: str :param endpoint_name: Inference Endpoint name. Required. :type endpoint_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: @@ -262,7 +254,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -272,11 +264,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -287,17 +280,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -314,12 +303,11 @@ async def get( :type workspace_name: str :param endpoint_name: Name for the Batch Endpoint. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BatchEndpoint or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.BatchEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -333,22 +321,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchEndpoint] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,26 +344,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore async def _update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BatchEndpoint]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +372,7 @@ async def _update_initial( api_version: str = 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.BatchEndpoint]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -400,7 +382,7 @@ async def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithIdentity") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -409,30 +391,29 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchEndpoint", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -440,14 +421,12 @@ async def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -477,14 +456,6 @@ async def begin_update( :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 BatchEndpoint or the result of cls(response) :rtype: @@ -498,7 +469,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -515,18 +486,10 @@ async def begin_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Mutable batch inference endpoint definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchEndpoint or the result of cls(response) :rtype: @@ -540,7 +503,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.BatchEndpoint]: """Update a batch inference endpoint (asynchronous). @@ -555,20 +518,10 @@ async def begin_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Mutable batch inference endpoint definition object. Is either a - PartialMinimalTrackedResourceWithIdentity type or a IO type. Required. + PartialMinimalTrackedResourceWithIdentity type or a IO[bytes] type. Required. :type body: - ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity 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. + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity or + IO[bytes] :return: An instance of AsyncLROPoller that returns either BatchEndpoint or the result of cls(response) :rtype: @@ -597,12 +550,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -612,27 +566,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.BatchEndpoint].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return AsyncLROPoller[_models.BatchEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.BatchEndpoint, IO], + body: Union[_models.BatchEndpoint, IO[bytes]], **kwargs: Any - ) -> _models.BatchEndpoint: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,7 +597,7 @@ async def _create_or_update_initial( api_version: str = 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.BatchEndpoint] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -655,7 +607,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "BatchEndpoint") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -664,29 +616,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchEndpoint", 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") @@ -695,17 +647,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/batchEndpoints/{endpointName}" - } - @overload async def begin_create_or_update( self, @@ -733,14 +681,6 @@ async def begin_create_or_update( :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 BatchEndpoint or the result of cls(response) :rtype: @@ -754,7 +694,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -771,18 +711,10 @@ async def begin_create_or_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Batch inference endpoint definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchEndpoint or the result of cls(response) :rtype: @@ -796,7 +728,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.BatchEndpoint, IO], + body: Union[_models.BatchEndpoint, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.BatchEndpoint]: """Creates a batch inference endpoint (asynchronous). @@ -810,20 +742,9 @@ async def begin_create_or_update( :type workspace_name: str :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str - :param body: Batch inference endpoint definition object. Is either a BatchEndpoint type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.BatchEndpoint 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. + :param body: Batch inference endpoint definition object. Is either a BatchEndpoint type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.BatchEndpoint or IO[bytes] :return: An instance of AsyncLROPoller that returns either BatchEndpoint or the result of cls(response) :rtype: @@ -852,12 +773,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -870,17 +792,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.BatchEndpoint].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}/batchEndpoints/{endpointName}" - } + return AsyncLROPoller[_models.BatchEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_keys( @@ -897,12 +817,11 @@ async def list_keys( :type workspace_name: str :param endpoint_name: Inference Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthKeys or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,22 +835,20 @@ async def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -941,13 +858,9 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/listkeys" - } + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capability_hosts_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capability_hosts_operations.py new file mode 100644 index 00000000000..130680c8fd4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_capability_hosts_operations.py @@ -0,0 +1,474 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._capability_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class CapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`capability_hosts` 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") + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete capabilityHost. + + Delete capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get capabilityHost. + + Get capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapabilityHost or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.CapabilityHost] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 b5739ccac07..a142b048f00 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._code_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,7 +77,6 @@ def list( :type workspace_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] @@ -86,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -97,18 +99,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -120,13 +120,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -136,11 +135,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,10 +152,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -172,12 +167,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,22 +185,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -217,11 +209,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/codes/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -238,12 +226,11 @@ async def get( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,22 +244,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -282,16 +267,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -320,7 +301,6 @@ async def create_or_update( :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: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -332,7 +312,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -349,11 +329,10 @@ async def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -365,7 +344,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any ) -> _models.CodeContainer: """Create or update container. @@ -379,18 +358,14 @@ async def create_or_update( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :param body: Container entity to create or update. Is either a CodeContainer 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 + :param body: Container entity to create or update. Is either a CodeContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO[bytes] :return: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,7 +388,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "CodeContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -422,16 +397,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,17 +414,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CodeContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}" - } 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 cf86e6d1580..8023443adf0 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,26 +18,33 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._code_versions_operations import ( build_create_or_get_start_pending_upload_request, build_create_or_update_request, build_delete_request, build_get_request, build_list_request, + build_publish_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +103,6 @@ def list( :type hash: str :param hash_version: Hash algorithm version when listing by hash. Default value is None. :type hash_version: 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] @@ -107,7 +114,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -118,7 +125,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -129,12 +136,10 @@ def prepare_request(next_link=None): hash=hash, hash_version=hash_version, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -146,13 +151,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -162,11 +166,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,10 +183,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -200,12 +200,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,23 +218,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,11 +243,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/codes/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -269,12 +262,11 @@ async def get( :type 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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -288,23 +280,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,16 +304,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -355,7 +341,6 @@ async def create_or_update( :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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -368,7 +353,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -387,11 +372,10 @@ async def create_or_update( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -404,7 +388,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any ) -> _models.CodeVersion: """Create or update version. @@ -420,18 +404,14 @@ async def create_or_update( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Version entity to create or update. Is either a CodeVersion 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 + :param body: Version entity to create or update. Is either a CodeVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO[bytes] :return: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -454,7 +434,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "CodeVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -464,16 +444,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -483,20 +461,235 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CodeVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" - } + async def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload async def create_or_get_start_pending_upload( @@ -528,7 +721,6 @@ async def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -541,7 +733,7 @@ async def create_or_get_start_pending_upload( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -560,11 +752,10 @@ async def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -577,7 +768,7 @@ async def create_or_get_start_pending_upload( workspace_name: str, name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a code asset to. @@ -593,18 +784,14 @@ async def create_or_get_start_pending_upload( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -627,7 +814,7 @@ async def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -637,16 +824,14 @@ async def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -656,13 +841,9 @@ async def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 d6244d2bfd2..12e7b3b1d6e 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._component_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +85,6 @@ 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 - :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] @@ -94,7 +96,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,19 +107,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -129,13 +129,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -145,11 +144,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,10 +161,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -181,12 +176,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,22 +194,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,11 +218,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/components/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -247,12 +235,11 @@ async def get( :type workspace_name: str :param name: Container name. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,22 +253,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,16 +276,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -329,7 +310,6 @@ async def create_or_update( :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: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -341,7 +321,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -358,11 +338,10 @@ async def create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +353,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any ) -> _models.ComponentContainer: """Create or update container. @@ -388,18 +367,14 @@ async def create_or_update( :type workspace_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a ComponentContainer 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 + :param body: Container entity to create or update. Is either a ComponentContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO[bytes] :return: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +397,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "ComponentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -431,16 +406,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,17 +423,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ComponentContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}" - } 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 5910c2b4922..730303e957e 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,25 +18,32 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._component_versions_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, + build_publish_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +99,6 @@ 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 - :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] @@ -103,7 +110,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +121,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -124,12 +131,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +146,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -157,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +178,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -195,12 +195,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,23 +213,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,11 +238,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/components/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -264,12 +257,11 @@ async def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,23 +275,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,16 +299,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -350,7 +336,6 @@ async def create_or_update( :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: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +348,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -382,11 +367,10 @@ async def create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -399,7 +383,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any ) -> _models.ComponentVersion: """Create or update version. @@ -415,18 +399,14 @@ async def create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ComponentVersion 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 + :param body: Version entity to create or update. Is either a ComponentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO[bytes] :return: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +429,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "ComponentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -459,16 +439,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,17 +456,232 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ComponentVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" - } + async def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 fff3c389b06..da3a73d8a87 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + List, + Optional, + Type, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +32,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,25 +46,33 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._compute_operations import ( build_create_or_update_request, build_delete_request, + build_get_allowed_resize_sizes_request, build_get_request, build_list_keys_request, build_list_nodes_request, build_list_request, + build_resize_request, build_restart_request, build_start_request, build_stop_request, + build_update_custom_services_request, + build_update_data_mounts_request, + build_update_idle_shutdown_setting_request, build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ComputeOperations: +class ComputeOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -80,7 +104,6 @@ def list( :type workspace_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 ComputeResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ComputeResource] @@ -92,7 +115,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PaginatedComputeResourcesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,18 +126,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -126,13 +147,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PaginatedComputeResourcesList", pipeline_response) @@ -142,11 +162,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,10 +179,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes" - } - @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -177,12 +193,11 @@ async def get( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ComputeResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComputeResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,22 +211,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComputeResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_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, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -221,26 +234,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ComputeResource, IO], + parameters: Union[_models.ComputeResource, IO[bytes]], **kwargs: Any - ) -> _models.ComputeResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -253,7 +262,7 @@ async def _create_or_update_initial( api_version: str = 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.ComputeResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -263,7 +272,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ComputeResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -272,45 +281,41 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ComputeResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/computes/{computeName}" - } - @overload async def begin_create_or_update( self, @@ -338,14 +343,6 @@ async def begin_create_or_update( :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 ComputeResource or the result of cls(response) :rtype: @@ -359,7 +356,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,18 +373,10 @@ async def begin_create_or_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Payload with Machine Learning compute definition. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 ComputeResource or the result of cls(response) :rtype: @@ -401,7 +390,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ComputeResource, IO], + parameters: Union[_models.ComputeResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ComputeResource]: """Creates or updates compute. This call will overwrite a compute if it exists. This is a @@ -416,19 +405,8 @@ async def begin_create_or_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Payload with Machine Learning compute definition. Is either a - ComputeResource type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.ComputeResource 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. + ComputeResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ComputeResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either ComputeResource or the result of cls(response) :rtype: @@ -457,12 +435,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -472,27 +451,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ComputeResource].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}/computes/{computeName}" - } + return AsyncLROPoller[_models.ComputeResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ClusterUpdateParameters, IO], + parameters: Union[_models.ClusterUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.ComputeResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -505,7 +482,7 @@ async def _update_initial( api_version: str = 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.ComputeResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -515,7 +492,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "ClusterUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -524,35 +501,34 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ComputeResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -580,14 +556,6 @@ async def begin_update( :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 ComputeResource or the result of cls(response) :rtype: @@ -601,7 +569,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -617,18 +585,10 @@ async def begin_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Additional parameters for cluster update. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 ComputeResource or the result of cls(response) :rtype: @@ -642,7 +602,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ClusterUpdateParameters, IO], + parameters: Union[_models.ClusterUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ComputeResource]: """Updates properties of a compute. This call will overwrite a compute if it exists. This is a @@ -656,19 +616,9 @@ async def begin_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Additional parameters for cluster update. Is either a - ClusterUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.ClusterUpdateParameters 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. + ClusterUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ClusterUpdateParameters or + IO[bytes] :return: An instance of AsyncLROPoller that returns either ComputeResource or the result of cls(response) :rtype: @@ -697,12 +647,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -712,27 +663,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ComputeResource].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/workspaces/{workspaceName}/computes/{computeName}" - } + return AsyncLROPoller[_models.ComputeResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, underlying_resource_action: Union[str, _models.UnderlyingResourceAction], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,30 +693,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, subscription_id=self._config.subscription_id, underlying_resource_action=underlying_resource_action, 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -779,12 +731,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -809,14 +761,6 @@ async def begin_delete( Required. :type underlying_resource_action: str or ~azure.mgmt.machinelearningservices.models.UnderlyingResourceAction - :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: @@ -830,7 +774,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -841,11 +785,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -854,17 +799,151 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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 [CustomService] type or a + IO[bytes] type. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, (IOBase, 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + if cls: + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_nodes( @@ -879,7 +958,6 @@ def list_nodes( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AmlComputeNodeInformation or the result of cls(response) :rtype: @@ -892,7 +970,7 @@ def list_nodes( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AmlComputeNodesInformation] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -903,18 +981,16 @@ def list_nodes( def prepare_request(next_link=None): if not next_link: - request = build_list_nodes_request( + _request = build_list_nodes_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, - template_url=self.list_nodes.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -926,13 +1002,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("AmlComputeNodesInformation", pipeline_response) @@ -942,11 +1017,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -959,10 +1034,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_nodes.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes" - } - @distributed_trace_async async def list_keys( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -976,12 +1047,11 @@ async def list_keys( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ComputeSecrets or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComputeSecrets :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -995,22 +1065,20 @@ async def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComputeSecrets] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_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, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1020,21 +1088,108 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComputeSecrets", pipeline_response) + deserialized = self._deserialize("ComputeSecrets", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys" - } + @overload + async def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: List[_models.ComputeInstanceDataMount], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update Data Mounts of a Machine Learning compute. - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. + Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update Data Mounts of a Machine Learning compute. + + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. + Required. + :type data_mounts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: Union[List[_models.ComputeInstanceDataMount], IO[bytes]], + **kwargs: Any ) -> None: - error_map = { + """Update Data Mounts of a Machine Learning compute. + + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. Is + either a [ComputeInstanceDataMount] type or a IO[bytes] type. Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1042,43 +1197,101 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = 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) - request = build_start_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(data_mounts, (IOBase, bytes)): + _content = data_mounts + else: + _json = self._serialize.body(data_mounts, "[ComputeInstanceDataMount]") + + _request = build_update_data_mounts_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, - template_url=self._start_initial.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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, {}) # type: ignore + + async def _start_initial( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start" - } + return deserialized # type: ignore @distributed_trace_async async def begin_start( @@ -1093,14 +1306,6 @@ async def begin_start( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1114,7 +1319,7 @@ async def begin_start( 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._start_initial( # type: ignore + raw_result = await self._start_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1124,11 +1329,12 @@ async def begin_start( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1137,22 +1343,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start" - } - - async def _stop_initial( # pylint: disable=inconsistent-return-statements + async def _stop_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1164,39 +1366,42 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_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, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop" - } + return deserialized # type: ignore @distributed_trace_async async def begin_stop( @@ -1211,14 +1416,6 @@ async def begin_stop( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1232,7 +1429,7 @@ async def begin_stop( 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._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1242,11 +1439,12 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1255,22 +1453,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop" - } - - async def _restart_initial( # pylint: disable=inconsistent-return-statements + async def _restart_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1282,39 +1476,42 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_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, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" - } + return deserialized # type: ignore @distributed_trace_async async def begin_restart( @@ -1329,14 +1526,6 @@ async def begin_restart( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1350,7 +1539,7 @@ async def begin_restart( 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._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1360,11 +1549,12 @@ async def begin_restart( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1373,14 +1563,413 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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 + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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 IdleShutdownSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, (IOBase, 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace_async + async def get_allowed_resize_sizes( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> _models.VirtualMachineSizeListResult: + """Returns supported virtual machine sizes for resize. + + :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 + :return: VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + + _request = build_get_allowed_resize_sizes_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("VirtualMachineSizeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _resize_initial( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResizeSchema") + + _request = build_resize_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.ResizeSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. Is + either a ResizeSchema type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._resize_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" - } + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_operations.py new file mode 100644 index 00000000000..ee0efea120b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_operations.py @@ -0,0 +1,786 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._connection_operations import ( + build_create_or_update_deployment_request, + build_delete_deployment_request, + build_get_all_models_request, + build_get_deployment_request, + build_get_models_request, + build_list_deployments_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection` 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_deployments( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the Azure OpenAI connection. + + Get all the deployments under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_deployments_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_deployment_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete Azure OpenAI connection deployment resource by name. + + Delete Azure OpenAI connection deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_deployment( + self, resource_group_name: str, workspace_name: str, connection_name: str, deployment_name: str, **kwargs: Any + ) -> _models.EndpointDeploymentResourcePropertiesBasicResource: + """Get deployments under the Azure OpenAI connection by name. + + Get deployments under the Azure OpenAI connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_deployment_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointDeploymentResourcePropertiesBasicResource") + + _request = build_create_or_update_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: _models.EndpointDeploymentResourcePropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Is either a EndpointDeploymentResourcePropertiesBasicResource + type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointDeploymentResourcePropertiesBasicResource] = 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_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointDeploymentResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_models( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointModelProperties"]: + """Get available models under the Azure OpenAI connection. + + Get available models under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either EndpointModelProperties or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get_all_models( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> _models.EndpointModels: + """Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: EndpointModels or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointModels + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + _request = build_get_all_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointModels", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_item_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_item_operations.py new file mode 100644 index 00000000000..165f4403775 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_item_operations.py @@ -0,0 +1,928 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._connection_rai_blocklist_item_operations import ( + build_add_bulk_request, + build_create_request, + build_delete_bulk_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiBlocklistItemOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist_item` 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") + + async def _add_bulk_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[List[_models.RaiBlocklistItemBulkRequest], IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "[RaiBlocklistItemBulkRequest]") + + _request = build_add_bulk_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: List[_models.RaiBlocklistItemBulkRequest], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Required. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[List[_models.RaiBlocklistItemBulkRequest], IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Is either a + [RaiBlocklistItemBulkRequest] type or a IO[bytes] type. Required. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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[List[_models.RaiBlocklistItemPropertiesBasicResource]] = 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._add_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "[RaiBlocklistItemPropertiesBasicResource]", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[List[_models.RaiBlocklistItemPropertiesBasicResource]].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_bulk_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_delete_bulk_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: JSON, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: List of RAI Blocklist Items Names. Required. + :type body: JSON + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + 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_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistItemPropertiesBasicResource: + """Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :return: RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistItemPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiBlocklistItemPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: Union[_models.RaiBlocklistItemPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiBlocklistItemPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: _models.RaiBlocklistItemPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: Union[_models.RaiBlocklistItemPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Is either a RaiBlocklistItemPropertiesBasicResource type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + or IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of AsyncLROPoller that returns either + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiBlocklistItemPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiBlocklistItemPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiBlocklistItemPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RaiBlocklistItemPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_items_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_items_operations.py new file mode 100644 index 00000000000..df8b5038f1c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_items_operations.py @@ -0,0 +1,161 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar +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.rest import AsyncHttpResponse, 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 ... import models as _models +from ...operations._connection_rai_blocklist_items_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiBlocklistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist_items` 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, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RaiBlocklistItemPropertiesBasicResource"]: + """Gets the custom blocklist items associated with the Azure OpenAI connection. + + Gets the custom blocklist items associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiBlocklistItemPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_operations.py new file mode 100644 index 00000000000..72d41c20bbb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklist_operations.py @@ -0,0 +1,514 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._connection_rai_blocklist_operations import ( + build_create_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiBlocklistOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist` 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") + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistPropertiesBasicResource: + """Gets the specified custom blocklist associated with the Azure OpenAI connection. + + Gets the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :return: RaiBlocklistPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiBlocklistPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[_models.RaiBlocklistPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiBlocklistPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: _models.RaiBlocklistPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiBlocklistPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiBlocklistPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[_models.RaiBlocklistPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Is either a RaiBlocklistPropertiesBasicResource type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of AsyncLROPoller that returns either RaiBlocklistPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiBlocklistPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiBlocklistPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RaiBlocklistPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklists_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklists_operations.py new file mode 100644 index 00000000000..7ef846754b4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_blocklists_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar +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.rest import AsyncHttpResponse, 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 ... import models as _models +from ...operations._connection_rai_blocklists_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiBlocklistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklists` 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, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RaiBlocklistPropertiesBasicResource"]: + """Gets the custom blocklists associated with the Azure OpenAI connection. + + Gets the custom blocklists associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiBlocklistPropertiesBasicResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policies_operations.py new file mode 100644 index 00000000000..2b4850b936c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policies_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar +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.rest import AsyncHttpResponse, 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 ... import models as _models +from ...operations._connection_rai_policies_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_policies` 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, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RaiPolicyPropertiesBasicResource"]: + """List the specified Content Filters associated with the Azure OpenAI connection. + + List the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiPolicyPropertiesBasicResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policy_operations.py new file mode 100644 index 00000000000..e8e05a8a833 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_connection_rai_policy_operations.py @@ -0,0 +1,508 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._connection_rai_policy_operations import ( + build_create_request, + build_delete_request, + build_get_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ConnectionRaiPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_policy` 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") + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI connection. + + Deletes the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, connection_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicyPropertiesBasicResource: + """Gets the specified Content Filters associated with the Azure OpenAI connection. + + Gets the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :return: RaiPolicyPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiPolicyPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: _models.RaiPolicyPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Is either a RaiPolicyPropertiesBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiPolicyPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiPolicyPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 90f77426827..4446ee651d6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._data_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +85,6 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataContainer or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.DataContainer] @@ -94,7 +96,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,19 +107,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -129,13 +129,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DataContainerResourceArmPaginatedResult", pipeline_response) @@ -145,11 +144,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,10 +161,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -181,12 +176,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,22 +194,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,11 +218,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/data/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -247,12 +235,11 @@ async def get( :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -266,22 +253,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,16 +276,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -329,7 +310,6 @@ async def create_or_update( :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: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -341,7 +321,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -358,11 +338,10 @@ async def create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -374,7 +353,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any ) -> _models.DataContainer: """Create or update container. @@ -388,18 +367,14 @@ async def create_or_update( :type workspace_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a DataContainer type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataContainer 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 + :param body: Container entity to create or update. Is either a DataContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataContainer or IO[bytes] :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +397,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "DataContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -431,16 +406,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,17 +423,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DataContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}" - } 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 875689bd263..741649ca8af 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,25 +18,32 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._data_versions_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, + build_publish_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,7 +107,6 @@ def list( ListViewType.All]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 DataVersionBase or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.DataVersionBase] @@ -111,7 +118,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +129,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -133,12 +140,10 @@ def prepare_request(next_link=None): tags=tags, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -150,13 +155,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DataVersionBaseResourceArmPaginatedResult", pipeline_response) @@ -166,11 +170,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -183,10 +187,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -204,12 +204,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,23 +222,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,11 +247,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/data/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -273,12 +266,11 @@ async def get( :type 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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -292,23 +284,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,16 +308,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -359,7 +345,6 @@ async def create_or_update( :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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: @@ -372,7 +357,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -391,11 +376,10 @@ async def create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: @@ -408,7 +392,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any ) -> _models.DataVersionBase: """Create or update version. @@ -424,18 +408,14 @@ async def create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a DataVersionBase type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase 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 + :param body: Version entity to create or update. Is either a DataVersionBase type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase or IO[bytes] :return: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +438,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "DataVersionBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -468,16 +448,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,17 +465,232 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DataVersionBase", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" - } + async def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 985905f3bf5..bd2840a2528 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._datastores_operations import ( build_create_or_update_request, build_delete_request, @@ -37,6 +36,10 @@ build_list_secrets_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -97,7 +100,6 @@ def list( :type order_by: str :param order_by_asc: Order by property in ascending order. Default value is False. :type order_by_asc: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Datastore or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Datastore] @@ -109,7 +111,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoreResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -120,7 +122,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -132,12 +134,10 @@ def prepare_request(next_link=None): order_by=order_by, order_by_asc=order_by_asc, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -149,13 +149,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DatastoreResourceArmPaginatedResult", pipeline_response) @@ -165,11 +164,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,10 +181,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -201,12 +196,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,22 +214,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -246,11 +238,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/datastores/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.Datastore: @@ -265,12 +253,11 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -284,22 +271,20 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,16 +294,12 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Datastore", pipeline_response) + deserialized = self._deserialize("Datastore", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -350,7 +331,6 @@ async def create_or_update( :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: @@ -362,7 +342,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], skip_validation: bool = False, *, content_type: str = "application/json", @@ -380,13 +360,12 @@ async def create_or_update( :param name: Datastore name. Required. :type name: str :param body: Datastore entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :param skip_validation: Flag to skip validation. Default value is False. :type skip_validation: bool :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: @@ -398,7 +377,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.Datastore, IO], + body: Union[_models.Datastore, IO[bytes]], skip_validation: bool = False, **kwargs: Any ) -> _models.Datastore: @@ -413,20 +392,16 @@ async def create_or_update( :type workspace_name: str :param name: Datastore name. Required. :type name: str - :param body: Datastore entity to create or update. Is either a Datastore type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.Datastore or IO + :param body: Datastore entity to create or update. Is either a Datastore type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Datastore or IO[bytes] :param skip_validation: Flag to skip validation. Default value is False. :type skip_validation: bool - :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +424,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "Datastore") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -459,16 +434,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,24 +451,85 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Datastore", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Datastore", pipeline_response) + deserialized = self._deserialize("Datastore", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}" - } + @overload + async def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[_models.SecretExpiry] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatastoreSecrets: + """Get datastore secrets. + + Get datastore secrets. + + :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 name: Datastore name. Required. + :type name: str + :param body: Secret expiry information. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.SecretExpiry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatastoreSecrets or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatastoreSecrets: + """Get datastore secrets. + + Get datastore secrets. + + :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 name: Datastore name. Required. + :type name: str + :param body: Secret expiry information. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DatastoreSecrets or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async async def list_secrets( - self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[Union[_models.SecretExpiry, IO[bytes]]] = None, + **kwargs: Any ) -> _models.DatastoreSecrets: """Get datastore secrets. @@ -508,12 +542,14 @@ async def list_secrets( :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param body: Secret expiry information. Is either a SecretExpiry type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.SecretExpiry or IO[bytes] :return: DatastoreSecrets or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,28 +557,41 @@ async def list_secrets( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = 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.DatastoreSecrets] = kwargs.pop("cls", None) - request = build_list_secrets_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "SecretExpiry") + else: + _json = None + + _request = build_list_secrets_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,13 +601,9 @@ async def list_secrets( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatastoreSecrets", pipeline_response) + deserialized = self._deserialize("DatastoreSecrets", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_deployment_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_deployment_operations.py new file mode 100644 index 00000000000..3eaebd2b5cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_deployment_operations.py @@ -0,0 +1,714 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._endpoint_deployment_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_in_workspace_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EndpointDeploymentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`endpoint_deployment` 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 get_in_workspace( + self, + resource_group_name: str, + workspace_name: str, + endpoint_type: Optional[Union[str, _models.EndpointType]] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the workspace scope. + + Get all the deployments under the workspace scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. Known values are: "Azure.OpenAI", "Azure.Speech", + "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and "serverlessEndpoint". + Default value is None. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_in_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + endpoint_type=endpoint_type, + skip=skip, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def list( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the endpoint resource scope. + + Get all the deployments under the endpoint resource scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete endpoint deployment resource by name. + + Delete endpoint deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any + ) -> _models.EndpointDeploymentResourcePropertiesBasicResource: + """Get deployments under endpoint resource by name. + + Get deployments under endpoint resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointDeploymentResourcePropertiesBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: _models.EndpointDeploymentResourcePropertiesBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Is either a EndpointDeploymentResourcePropertiesBasicResource + type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointDeploymentResourcePropertiesBasicResource] = 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, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointDeploymentResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_operations.py new file mode 100644 index 00000000000..8e87543328f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_endpoint_operations.py @@ -0,0 +1,775 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._endpoint_operations import ( + build_create_or_update_request, + build_get_models_request, + build_get_request, + build_list_keys_request, + build_list_request, + build_regenerate_keys_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class EndpointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`endpoint` 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, + endpoint_type: Optional[Union[str, _models.EndpointType]] = None, + include_online_endpoints: bool = False, + include_serverless_endpoints: bool = False, + include_connections: bool = False, + skip: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.EndpointResourcePropertiesBasicResource"]: + """List All the endpoints under this workspace. + + List All the endpoints under this 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. Known values are: "Azure.OpenAI", "Azure.Speech", + "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and "serverlessEndpoint". + Default value is None. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param include_online_endpoints: Default value is False. + :type include_online_endpoints: bool + :param include_serverless_endpoints: Default value is False. + :type include_serverless_endpoints: bool + :param include_connections: Default value is False. + :type include_connections: bool + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param expand: Whether the endpoint resource will be expand to include deployment information, + e.g. $expand=deployments. Default value is None. + :type expand: str + :return: An iterator like instance of either EndpointResourcePropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_type=endpoint_type, + include_online_endpoints=include_online_endpoints, + include_serverless_endpoints=include_serverless_endpoints, + include_connections=include_connections, + skip=skip, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.EndpointResourcePropertiesBasicResource: + """Gets endpoint resource. + + Gets endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointResourcePropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointResourcePropertiesBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: _models.EndpointResourcePropertiesBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either + EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Is either a EndpointResourcePropertiesBasicResource type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + or IO[bytes] + :return: An instance of AsyncLROPoller that returns either + EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointResourcePropertiesBasicResource] = 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, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.EndpointResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def list_keys( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.EndpointKeys: + """List keys for the endpoint resource. + + List keys for the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: EndpointKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointKeys] = kwargs.pop("cls", None) + + _request = build_list_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_models( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterable["_models.EndpointModelProperties"]: + """Get available models under the endpoint resource. + + Get available models under the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: An iterator like instance of either EndpointModelProperties or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: _models.RegenerateServiceAccountKeyContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.RegenerateServiceAccountKeyContent, IO[bytes]], + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Is either a RegenerateServiceAccountKeyContent type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent or + IO[bytes] + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.AccountApiKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RegenerateServiceAccountKeyContent") + + _request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("AccountApiKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore 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 1db0500ea54..5eda2d4075f 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._environment_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,7 +85,6 @@ 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 - :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: @@ -95,7 +97,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,19 +108,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -130,13 +130,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -146,11 +145,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -163,10 +162,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -182,12 +177,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -201,22 +195,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -227,11 +219,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/environments/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -248,12 +236,11 @@ async def get( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,22 +254,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -292,16 +277,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -330,7 +311,6 @@ async def create_or_update( :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: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -342,7 +322,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -359,11 +339,10 @@ async def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +354,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any ) -> _models.EnvironmentContainer: """Create or update container. @@ -390,17 +369,13 @@ async def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Is either a EnvironmentContainer 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 + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO[bytes] :return: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +398,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "EnvironmentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -432,16 +407,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,17 +424,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}" - } 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 031930c06fc..d4de6fcb8d2 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,25 +18,32 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._environment_versions_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, + build_publish_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +99,6 @@ 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 - :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] @@ -103,7 +110,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +121,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -124,12 +131,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +146,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -157,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,10 +178,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -195,12 +195,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,23 +213,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -241,11 +238,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/environments/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -264,12 +257,11 @@ async def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -283,23 +275,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,16 +299,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -350,7 +336,6 @@ async def create_or_update( :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: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -363,7 +348,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -382,11 +367,10 @@ async def create_or_update( :param version: Version of EnvironmentVersion. Required. :type version: str :param body: Definition of EnvironmentVersion. Required. - :type body: IO + :type body: IO[bytes] :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: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -399,7 +383,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any ) -> _models.EnvironmentVersion: """Creates or updates an EnvironmentVersion. @@ -415,18 +399,14 @@ async def create_or_update( :type name: str :param version: Version of EnvironmentVersion. Required. :type version: str - :param body: Definition of EnvironmentVersion. Is either a EnvironmentVersion 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 + :param body: Definition of EnvironmentVersion. Is either a EnvironmentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO[bytes] :return: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -449,7 +429,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "EnvironmentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -459,16 +439,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -478,17 +456,232 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" - } + async def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_features_operations.py new file mode 100644 index 00000000000..bfb315f9929 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_features_operations.py @@ -0,0 +1,257 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar, Union +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.rest import AsyncHttpResponse, 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 ... import models as _models +from ...operations._features_operations import build_get_request, build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`features` 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, + featureset_name: str, + featureset_version: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + feature_name: Optional[str] = None, + description: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 1000, + **kwargs: Any + ) -> AsyncIterable["_models.Feature"]: + """List Features. + + List Features. + + :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 featureset_name: Featureset name. This is case-sensitive. Required. + :type featureset_name: str + :param featureset_version: Featureset Version identifier. This is case-sensitive. Required. + :type featureset_version: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param feature_name: feature name. Default value is None. + :type feature_name: str + :param description: Description of the featureset. Default value is None. + :type description: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: Page size. Default value is 1000. + :type page_size: int + :return: An iterator like instance of either Feature or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Feature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeatureResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + featureset_name=featureset_name, + featureset_version=featureset_version, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + feature_name=feature_name, + description=description, + list_view_type=list_view_type, + page_size=page_size, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FeatureResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + workspace_name: str, + featureset_name: str, + featureset_version: str, + feature_name: str, + **kwargs: Any + ) -> _models.Feature: + """Get feature. + + Get feature. + + :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 featureset_name: Feature set name. This is case-sensitive. Required. + :type featureset_name: str + :param featureset_version: Feature set version identifier. This is case-sensitive. Required. + :type featureset_version: str + :param feature_name: Feature Name. This is case-sensitive. Required. + :type feature_name: str + :return: Feature or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Feature + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Feature] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + featureset_name=featureset_name, + featureset_version=featureset_version, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("Feature", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_containers_operations.py new file mode 100644 index 00000000000..00be38ce262 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_containers_operations.py @@ -0,0 +1,599 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._featureset_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeaturesetContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`featureset_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, + workspace_name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.FeaturesetContainer"]: + """List featurestore entity containers. + + List featurestore entity containers. + + :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 tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param name: name for the featureset. Default value is None. + :type name: str + :param description: description for the feature set. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :return: An iterator like instance of either FeaturesetContainer or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + name=name, + description=description, + created_by=created_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturesetContainerResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_entity( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.FeaturesetContainer: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :return: FeaturesetContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetContainer] = kwargs.pop("cls", None) + + _request = build_get_entity_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturesetContainer", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetContainer") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.FeaturesetContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Is either a FeaturesetContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer or IO[bytes] + :return: An instance of AsyncLROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetContainer] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetContainer", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FeaturesetContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_versions_operations.py new file mode 100644 index 00000000000..220e00baccd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featureset_versions_operations.py @@ -0,0 +1,865 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._featureset_versions_operations import ( + build_backfill_request, + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeaturesetVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`featureset_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, + workspace_name: str, + name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.FeaturesetVersion"]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Featureset name. This is case-sensitive. Required. + :type name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param version_name: name for the featureset version. Default value is None. + :type version_name: str + :param version: featureset version. Default value is None. + :type version: str + :param description: description for the feature set version. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :param stage: Specifies the featurestore stage. Default value is None. + :type stage: str + :return: An iterator like instance of either FeaturesetVersion or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + name=name, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + version_name=version_name, + version=version, + description=description, + created_by=created_by, + stage=stage, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> _models.FeaturesetVersion: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :return: FeaturesetVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturesetVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetVersion") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturesetVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Is either a FeaturesetVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion or IO[bytes] + :return: An instance of AsyncLROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetVersion] = 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, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersion", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FeaturesetVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _backfill_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetVersionBackfillRequest") + + _request = build_backfill_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturesetVersionBackfillRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetVersionBackfillResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturesetVersionBackfillResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Is either a + FeaturesetVersionBackfillRequest type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either FeaturesetVersionBackfillResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetVersionBackfillResponse] = 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._backfill_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetVersionBackfillResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FeaturesetVersionBackfillResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_containers_operations.py new file mode 100644 index 00000000000..41b1bb8aea9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_containers_operations.py @@ -0,0 +1,600 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._featurestore_entity_containers_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_entity_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeaturestoreEntityContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`featurestore_entity_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, + workspace_name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.FeaturestoreEntityContainer"]: + """List featurestore entity containers. + + List featurestore entity containers. + + :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 tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param name: name for the featurestore entity. Default value is None. + :type name: str + :param description: description for the featurestore entity. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :return: An iterator like instance of either FeaturestoreEntityContainer or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + name=name, + description=description, + created_by=created_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainerResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_entity( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.FeaturestoreEntityContainer: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :return: FeaturestoreEntityContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityContainer] = kwargs.pop("cls", None) + + _request = build_get_entity_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturestoreEntityContainer", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturestoreEntityContainer") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.FeaturestoreEntityContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityContainer or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityContainer or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Is either a FeaturestoreEntityContainer type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer or IO[bytes] + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityContainer or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturestoreEntityContainer] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturestoreEntityContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FeaturestoreEntityContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_versions_operations.py new file mode 100644 index 00000000000..e02cec4979b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_featurestore_entity_versions_operations.py @@ -0,0 +1,631 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._featurestore_entity_versions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class FeaturestoreEntityVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`featurestore_entity_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, + workspace_name: str, + name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.FeaturestoreEntityVersion"]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Feature entity name. This is case-sensitive. Required. + :type name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param version_name: name for the featurestore entity version. Default value is None. + :type version_name: str + :param version: featurestore entity version. Default value is None. + :type version: str + :param description: description for the feature entity version. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :param stage: Specifies the featurestore stage. Default value is None. + :type stage: str + :return: An iterator like instance of either FeaturestoreEntityVersion or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + name=name, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + version_name=version_name, + version=version, + description=description, + created_by=created_by, + stage=stage, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> _models.FeaturestoreEntityVersion: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :return: FeaturestoreEntityVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturestoreEntityVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturestoreEntityVersion") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturestoreEntityVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Is either a FeaturestoreEntityVersion type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion or IO[bytes] + :return: An instance of AsyncLROPoller that returns either FeaturestoreEntityVersion or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturestoreEntityVersion] = 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, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturestoreEntityVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FeaturestoreEntityVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_endpoints_operations.py new file mode 100644 index 00000000000..c142eb89dea --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_endpoints_operations.py @@ -0,0 +1,770 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._inference_endpoints_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InferenceEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`inference_endpoints` 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, + pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.InferenceEndpoint"]: + """List Inference Endpoints. + + List Inference Endpoints. + + :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 pool_name: Name of the InferencePool. Required. + :type pool_name: str + :param count: Number of InferenceEndpoint to be retrieved in a page of results. Default value + is None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferenceEndpoint or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InferenceEndpointTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete InferenceEndpoint (asynchronous). + + Delete InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.InferenceEndpoint: + """Get InferenceEndpoint. + + Get InferenceEndpoint. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :return: InferenceEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceEndpoint] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferenceEndpoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceEndpoint]: + """Update InferenceEndpoint (asynchronous). + + Update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: any + :return: An instance of AsyncLROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.InferenceEndpoint] = 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, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferenceEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Union[_models.InferenceEndpoint, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferenceEndpoint") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: _models.InferenceEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Union[_models.InferenceEndpoint, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Is either a InferenceEndpoint + type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint or IO[bytes] + :return: An instance of AsyncLROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceEndpoint] = 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, + pool_name=pool_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferenceEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_groups_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_groups_operations.py new file mode 100644 index 00000000000..a6b23fc0239 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_groups_operations.py @@ -0,0 +1,1591 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._inference_groups_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_delta_models_status_async_request, + build_get_request, + build_get_status_request, + build_list_delta_models_async_request, + build_list_request, + build_list_skus_request, + build_modify_delta_models_async_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InferenceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`inference_groups` 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, + pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.InferenceGroup"]: + """List Inference Groups. + + List Inference Groups. + + :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 pool_name: Name of the InferencePool. Required. + :type pool_name: str + :param count: Number of InferenceGroup to be retrieved in a page of results. Default value is + None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferenceGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceGroupTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InferenceGroupTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete InferenceGroup (asynchronous). + + Delete InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> _models.InferenceGroup: + """Get InferenceGroup. + + Get InferenceGroup. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :return: InferenceGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceGroup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferenceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSku") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.PartialMinimalTrackedResourceWithSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSku type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceGroup] = 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, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferenceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.InferenceGroup, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferenceGroup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.InferenceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.InferenceGroup, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Is either a InferenceGroup type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup or IO[bytes] + :return: An instance of AsyncLROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceGroup] = 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, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferenceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelStatusRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelStatusRequest, IO[bytes]], + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Is either a DeltaModelStatusRequest type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusRequest or IO[bytes] + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.DeltaModelStatusResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelStatusRequest") + + _request = build_get_delta_models_status_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DeltaModelStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelListRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncIterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelListRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Is either a DeltaModelListRequest type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelListRequest or IO[bytes] + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.StringArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelListRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_delta_models_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("StringArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _modify_delta_models_async_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelModifyRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelModifyRequest") + + _request = build_modify_delta_models_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelModifyRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelModifyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelModifyRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Is either a DeltaModelModifyRequest type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelModifyRequest or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._modify_delta_models_async_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get_status( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> _models.GroupStatus: + """Retrieve inference group status. + + Retrieve inference group status. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :return: GroupStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GroupStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupStatus] = kwargs.pop("cls", None) + + _request = build_get_status_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("GroupStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_skus( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SkuResource"]: + """List Inference Group Skus. + + List Inference Group Skus. + + :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 pool_name: Inference Pool name. Required. + :type pool_name: str + :param group_name: Inference Group name. Required. + :type group_name: str + :param count: Number of Skus to be retrieved in a page of results. Default value is None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :return: An iterator like instance of either SkuResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.SkuResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_skus_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SkuResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_pools_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_pools_operations.py new file mode 100644 index 00000000000..dbb73f099bf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_inference_pools_operations.py @@ -0,0 +1,820 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._inference_pools_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InferencePoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`inference_pools` 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, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> AsyncIterable["_models.InferencePool"]: + """List InferencePools. + + List InferencePools. + + :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 count: Number of inferencePools to be retrieved in a page of results. Default value is + None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferencePool or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferencePoolTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("InferencePoolTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete InferencePool (asynchronous). + + Delete InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> _models.InferencePool: + """Get InferencePool. + + Get InferencePool. + + :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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :return: InferencePool or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferencePool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferencePool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferencePool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSkuAndIdentity") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferencePool] = 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, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferencePool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferencePool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferencePool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: _models.InferencePool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Is either a InferencePool type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool or IO[bytes] + :return: An instance of AsyncLROPoller that returns either InferencePool or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferencePool] = 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, + inference_pool_name=inference_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferencePool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.InferencePool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 8196b0804d3..fd7857069a4 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._jobs_operations import ( build_cancel_request, build_create_or_update_request, @@ -39,6 +40,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,6 +76,7 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + properties: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -91,7 +97,9 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response + :param properties: Comma-separated list of user property names (and optionally values). + Example: prop1,prop2=value2. Default value is None. + :type properties: str :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.JobBase] @@ -103,7 +111,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +122,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -122,13 +130,12 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + properties=properties, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +147,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("JobBaseResourceArmPaginatedResult", pipeline_response) @@ -156,11 +162,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,14 +179,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,29 +194,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -227,12 +232,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -249,14 +254,6 @@ async def begin_delete( :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. 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: @@ -270,7 +267,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -280,11 +277,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -295,17 +293,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/jobs/{id}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> _models.JobBase: @@ -320,12 +314,11 @@ async def get(self, resource_group_name: str, workspace_name: str, id: str, **kw :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,22 +332,20 @@ async def get(self, resource_group_name: str, workspace_name: str, id: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_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.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,16 +355,12 @@ async def get(self, resource_group_name: str, workspace_name: str, id: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobBase", pipeline_response) + deserialized = self._deserialize("JobBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -387,8 +374,10 @@ async def create_or_update( **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -402,7 +391,6 @@ async def create_or_update( :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: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: @@ -414,14 +402,16 @@ async def create_or_update( resource_group_name: str, workspace_name: str, id: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -431,11 +421,10 @@ async def create_or_update( :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str :param body: Job definition object. Required. - :type body: IO + :type body: IO[bytes] :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: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: @@ -443,11 +432,18 @@ async def create_or_update( @distributed_trace_async async def create_or_update( - self, resource_group_name: str, workspace_name: str, id: str, body: Union[_models.JobBase, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.JobBase, IO[bytes]], + **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -456,17 +452,13 @@ async def create_or_update( :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str - :param body: Job definition object. Is either a JobBase type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.JobBase 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 + :param body: Job definition object. Is either a JobBase type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.JobBase or IO[bytes] :return: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -489,7 +481,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "JobBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -498,16 +490,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -517,25 +507,17 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("JobBase", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JobBase", pipeline_response) + deserialized = self._deserialize("JobBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } - - async def _cancel_initial( # pylint: disable=inconsistent-return-statements + async def _cancel_initial( self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,29 +529,32 @@ async def _cancel_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_cancel_request( + _request = build_cancel_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._cancel_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -579,12 +564,12 @@ async def _cancel_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _cancel_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel" - } + return deserialized # type: ignore @distributed_trace_async async def begin_cancel( @@ -601,14 +586,6 @@ async def begin_cancel( :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. 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: @@ -622,7 +599,7 @@ async def begin_cancel( 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._cancel_initial( # type: ignore + raw_result = await self._cancel_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -632,11 +609,12 @@ async def begin_cancel( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -647,14 +625,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_cancel.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_provisions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_provisions_operations.py new file mode 100644 index 00000000000..1f76977b494 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_provisions_operations.py @@ -0,0 +1,274 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._managed_network_provisions_operations import build_provision_managed_network_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedNetworkProvisionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`managed_network_provisions` 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") + + async def _provision_managed_network_initial( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[Union[_models.ManagedNetworkProvisionOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ManagedNetworkProvisionOptions") + else: + _json = None + + _request = build_provision_managed_network_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[_models.ManagedNetworkProvisionOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Default + value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Default + value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[Union[_models.ManagedNetworkProvisionOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Is either a + ManagedNetworkProvisionOptions type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ManagedNetworkProvisionStatus] = 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._provision_managed_network_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ManagedNetworkProvisionStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedNetworkProvisionStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_settings_rule_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_settings_rule_operations.py new file mode 100644 index 00000000000..0d58d204c9f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,560 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._managed_network_settings_rule_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ManagedNetworkSettingsRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`managed_network_settings_rule` 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, **kwargs: Any + ) -> AsyncIterable["_models.OutboundRuleBasicResource"]: + """Lists the managed network outbound rules for a machine learning workspace. + + Lists the managed network outbound rules for a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: An iterator like instance of either OutboundRuleBasicResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundRuleListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundRuleListResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an outbound rule from the managed network of a machine learning workspace. + + Deletes an outbound rule from the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> _models.OutboundRuleBasicResource: + """Gets an outbound rule from the managed network of a machine learning workspace. + + Gets an outbound rule from the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :return: OutboundRuleBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundRuleBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("OutboundRuleBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "OutboundRuleBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: _models.OutboundRuleBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OutboundRuleBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either OutboundRuleBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Is either a OutboundRuleBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either OutboundRuleBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.OutboundRuleBasicResource] = 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, + rule_name=rule_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OutboundRuleBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.OutboundRuleBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.OutboundRuleBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_marketplace_subscriptions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_marketplace_subscriptions_operations.py new file mode 100644 index 00000000000..4f698ca08c3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_marketplace_subscriptions_operations.py @@ -0,0 +1,569 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._marketplace_subscriptions_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class MarketplaceSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`marketplace_subscriptions` 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, **kwargs: Any + ) -> AsyncIterable["_models.MarketplaceSubscription"]: + """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 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 + :return: An iterator like instance of either MarketplaceSubscription or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceSubscriptionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscriptionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete Marketplace Subscription (asynchronous). + + Delete Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.MarketplaceSubscription: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. Required. + :type name: str + :return: MarketplaceSubscription or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("MarketplaceSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "MarketplaceSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.MarketplaceSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MarketplaceSubscription or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either MarketplaceSubscription or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Is either a + MarketplaceSubscription type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription or IO[bytes] + :return: An instance of AsyncLROPoller that returns either MarketplaceSubscription or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.MarketplaceSubscription] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.MarketplaceSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MarketplaceSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 bb66007e652..b1d90ff43b2 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._model_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +88,6 @@ 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 - :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] @@ -97,7 +99,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,7 +110,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -116,12 +118,10 @@ def prepare_request(next_link=None): count=count, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +133,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -149,11 +148,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,10 +165,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -185,12 +180,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -204,22 +198,20 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -230,11 +222,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/models/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -251,12 +239,11 @@ async def get( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -270,22 +257,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -295,16 +280,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -333,7 +314,6 @@ async def create_or_update( :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: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -345,7 +325,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -362,11 +342,10 @@ async def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -378,7 +357,7 @@ async def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any ) -> _models.ModelContainer: """Create or update container. @@ -392,18 +371,14 @@ async def create_or_update( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :param body: Container entity to create or update. Is either a ModelContainer 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 + :param body: Container entity to create or update. Is either a ModelContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO[bytes] :return: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -426,7 +401,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "ModelContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -435,16 +410,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -454,17 +427,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ModelContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}" - } 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 8d601cec007..3207611c8c8 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,25 +18,32 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._model_versions_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, + build_publish_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -111,7 +119,6 @@ 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 - :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] @@ -123,7 +130,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +141,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -150,12 +157,10 @@ def prepare_request(next_link=None): feed=feed, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -167,13 +172,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -183,11 +187,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -200,10 +204,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions" - } - @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -221,12 +221,11 @@ async def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,23 +239,21 @@ async def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -267,11 +264,7 @@ async def delete( # pylint: disable=inconsistent-return-statements 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}/models/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -290,12 +283,11 @@ async def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,23 +301,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,16 +325,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -376,7 +362,6 @@ async def create_or_update( :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: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -389,7 +374,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -408,11 +393,10 @@ async def create_or_update( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -425,7 +409,7 @@ async def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any ) -> _models.ModelVersion: """Create or update version. @@ -441,18 +425,14 @@ async def create_or_update( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Version entity to create or update. Is either a ModelVersion 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 + :param body: Version entity to create or update. Is either a ModelVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO[bytes] :return: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -475,7 +455,7 @@ async def create_or_update( else: _json = self._serialize.body(body, "ModelVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -485,16 +465,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -504,17 +482,232 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ModelVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" - } + async def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 b3dd667cf62..994bfd857dc 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._online_deployments_operations import ( build_create_or_update_request, build_delete_request, @@ -41,6 +42,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,7 +97,6 @@ def list( :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 OnlineDeployment or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.OnlineDeployment] @@ -104,7 +108,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -115,7 +119,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -124,12 +128,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -141,13 +143,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OnlineDeploymentTrackedResourceArmPaginatedResult", pipeline_response) @@ -157,11 +158,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -174,14 +175,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,30 +190,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -229,12 +229,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -253,14 +253,6 @@ async def begin_delete( :type endpoint_name: str :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_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: @@ -274,7 +266,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -285,11 +277,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -300,17 +293,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -329,12 +318,11 @@ async def get( :type endpoint_name: str :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OnlineDeployment or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.OnlineDeployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,23 +336,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineDeployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,16 +360,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore async def _update_initial( self, @@ -391,10 +373,10 @@ async def _update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnlineDeployment]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +389,7 @@ async def _update_initial( api_version: str = 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.OnlineDeployment]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,7 +399,7 @@ async def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSku") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -427,30 +409,29 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineDeployment", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -458,14 +439,12 @@ async def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -497,14 +476,6 @@ async def begin_update( :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 OnlineDeployment or the result of cls(response) :rtype: @@ -519,7 +490,7 @@ async def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -538,18 +509,10 @@ async def begin_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineDeployment or the result of cls(response) :rtype: @@ -564,7 +527,7 @@ async def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OnlineDeployment]: """Update Online Deployment (asynchronous). @@ -581,20 +544,9 @@ async def begin_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Online Endpoint entity to apply during operation. Is either a - PartialMinimalTrackedResourceWithSku type or a IO type. Required. + PartialMinimalTrackedResourceWithSku type or a IO[bytes] type. Required. :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku 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. + IO[bytes] :return: An instance of AsyncLROPoller that returns either OnlineDeployment or the result of cls(response) :rtype: @@ -624,12 +576,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -639,17 +592,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OnlineDeployment].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[_models.OnlineDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _create_or_update_initial( self, @@ -657,10 +608,10 @@ async def _create_or_update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.OnlineDeployment, IO], + body: Union[_models.OnlineDeployment, IO[bytes]], **kwargs: Any - ) -> _models.OnlineDeployment: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +624,7 @@ async def _create_or_update_initial( api_version: str = 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.OnlineDeployment] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -683,7 +634,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "OnlineDeployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -693,29 +644,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineDeployment", 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") @@ -724,17 +675,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } - @overload async def begin_create_or_update( self, @@ -765,14 +712,6 @@ async def begin_create_or_update( :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 OnlineDeployment or the result of cls(response) :rtype: @@ -787,7 +726,7 @@ async def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -806,18 +745,10 @@ async def begin_create_or_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Inference Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineDeployment or the result of cls(response) :rtype: @@ -832,7 +763,7 @@ async def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.OnlineDeployment, IO], + body: Union[_models.OnlineDeployment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OnlineDeployment]: """Create or update Inference Endpoint Deployment (asynchronous). @@ -849,19 +780,8 @@ async def begin_create_or_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Inference Endpoint entity to apply during operation. Is either a OnlineDeployment - type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.OnlineDeployment 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. + type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OnlineDeployment or IO[bytes] :return: An instance of AsyncLROPoller that returns either OnlineDeployment or the result of cls(response) :rtype: @@ -891,12 +811,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -909,17 +830,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OnlineDeployment].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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return AsyncLROPoller[_models.OnlineDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def get_logs( @@ -951,7 +870,6 @@ async def get_logs( :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: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: @@ -964,7 +882,7 @@ async def get_logs( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -983,11 +901,10 @@ async def get_logs( :param deployment_name: The name and identifier for the endpoint. Required. :type deployment_name: str :param body: The request containing parameters for retrieving logs. Required. - :type body: IO + :type body: IO[bytes] :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: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: @@ -1000,7 +917,7 @@ async def get_logs( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.DeploymentLogsRequest, IO], + body: Union[_models.DeploymentLogsRequest, IO[bytes]], **kwargs: Any ) -> _models.DeploymentLogs: """Polls an Endpoint operation. @@ -1017,17 +934,13 @@ async def get_logs( :param deployment_name: The name and identifier for the endpoint. Required. :type deployment_name: str :param body: The request containing parameters for retrieving logs. Is either a - DeploymentLogsRequest type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.DeploymentLogsRequest 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 + DeploymentLogsRequest type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeploymentLogsRequest or IO[bytes] :return: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1050,7 +963,7 @@ async def get_logs( else: _json = self._serialize.body(body, "DeploymentLogsRequest") - request = build_get_logs_request( + _request = build_get_logs_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1060,16 +973,14 @@ async def get_logs( content_type=content_type, json=_json, content=_content, - template_url=self.get_logs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1079,16 +990,12 @@ async def get_logs( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLogs", pipeline_response) + deserialized = self._deserialize("DeploymentLogs", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_logs.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/getLogs" - } + return deserialized # type: ignore @distributed_trace def list_skus( @@ -1118,7 +1025,6 @@ def list_skus( :type count: 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 SkuResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.SkuResource] @@ -1130,7 +1036,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1141,7 +1047,7 @@ def list_skus( def prepare_request(next_link=None): if not next_link: - request = build_list_skus_request( + _request = build_list_skus_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1150,12 +1056,10 @@ def prepare_request(next_link=None): count=count, skip=skip, api_version=api_version, - template_url=self.list_skus.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1167,13 +1071,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SkuResourceArmPaginatedResult", pipeline_response) @@ -1183,11 +1086,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1199,7 +1102,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_skus.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/skus" - } 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 314c13e55c0..9c3c2df4a43 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._online_endpoints_operations import ( build_create_or_update_request, build_delete_request, @@ -42,6 +43,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -108,7 +113,6 @@ def list( :param order_by: The option to order the response. Known values are: "CreatedAtDesc", "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OnlineEndpoint or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] @@ -120,7 +124,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -131,7 +135,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -143,12 +147,10 @@ def prepare_request(next_link=None): properties=properties, order_by=order_by, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -160,13 +162,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OnlineEndpointTrackedResourceArmPaginatedResult", pipeline_response) @@ -176,11 +177,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -193,14 +194,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -212,29 +209,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -247,12 +247,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -269,14 +269,6 @@ async def begin_delete( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_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: @@ -290,7 +282,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -300,11 +292,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -315,17 +308,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -342,12 +331,11 @@ async def get( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OnlineEndpoint or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -361,22 +349,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineEndpoint] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -386,26 +372,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore async def _update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnlineEndpoint]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -418,7 +400,7 @@ async def _update_initial( api_version: str = 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.OnlineEndpoint]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,7 +410,7 @@ async def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithIdentity") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -437,30 +419,29 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineEndpoint", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -468,14 +449,12 @@ async def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -505,14 +484,6 @@ async def begin_update( :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -526,7 +497,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -543,18 +514,10 @@ async def begin_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -568,7 +531,7 @@ async def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OnlineEndpoint]: """Update Online Endpoint (asynchronous). @@ -583,20 +546,10 @@ async def begin_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Is either a - PartialMinimalTrackedResourceWithIdentity type or a IO type. Required. + PartialMinimalTrackedResourceWithIdentity type or a IO[bytes] type. Required. :type body: - ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity 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. + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity or + IO[bytes] :return: An instance of AsyncLROPoller that returns either OnlineEndpoint or the result of cls(response) :rtype: @@ -625,12 +578,13 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -640,27 +594,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OnlineEndpoint].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return AsyncLROPoller[_models.OnlineEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.OnlineEndpoint, IO], + body: Union[_models.OnlineEndpoint, IO[bytes]], **kwargs: Any - ) -> _models.OnlineEndpoint: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -673,7 +625,7 @@ async def _create_or_update_initial( api_version: str = 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.OnlineEndpoint] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -683,7 +635,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "OnlineEndpoint") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -692,29 +644,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineEndpoint", 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") @@ -723,17 +675,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/onlineEndpoints/{endpointName}" - } - @overload async def begin_create_or_update( self, @@ -761,14 +709,6 @@ async def begin_create_or_update( :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -782,7 +722,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -799,18 +739,10 @@ async def begin_create_or_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -824,7 +756,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.OnlineEndpoint, IO], + body: Union[_models.OnlineEndpoint, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.OnlineEndpoint]: """Create or update Online Endpoint (asynchronous). @@ -839,19 +771,8 @@ async def begin_create_or_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Is either a OnlineEndpoint type - or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint 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. + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint or IO[bytes] :return: An instance of AsyncLROPoller that returns either OnlineEndpoint or the result of cls(response) :rtype: @@ -880,12 +801,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -898,17 +820,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OnlineEndpoint].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}/onlineEndpoints/{endpointName}" - } + return AsyncLROPoller[_models.OnlineEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_keys( @@ -925,12 +845,11 @@ async def list_keys( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthKeys or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,22 +863,20 @@ async def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -969,26 +886,22 @@ async def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/listKeys" - } + return deserialized # type: ignore - async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements + async def _regenerate_keys_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.RegenerateEndpointKeysRequest, IO], + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1001,7 +914,7 @@ async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-state api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1011,7 +924,7 @@ async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-state else: _json = self._serialize.body(body, "RegenerateEndpointKeysRequest") - request = build_regenerate_keys_request( + _request = build_regenerate_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1020,21 +933,24 @@ async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-state content_type=content_type, json=_json, content=_content, - template_url=self._regenerate_keys_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -1044,12 +960,12 @@ async def _regenerate_keys_initial( # pylint: disable=inconsistent-return-state response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _regenerate_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys" - } + return deserialized # type: ignore @overload async def begin_regenerate_keys( @@ -1078,14 +994,6 @@ async def begin_regenerate_keys( :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1097,7 +1005,7 @@ async def begin_regenerate_keys( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1114,18 +1022,10 @@ async def begin_regenerate_keys( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: RegenerateKeys request . Required. - :type body: IO + :type body: IO[bytes] :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 None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1137,7 +1037,7 @@ async def begin_regenerate_keys( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.RegenerateEndpointKeysRequest, IO], + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[None]: """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). @@ -1151,20 +1051,10 @@ async def begin_regenerate_keys( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest 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. + :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest or + IO[bytes] :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: @@ -1179,7 +1069,7 @@ async def begin_regenerate_keys( 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._regenerate_keys_initial( # type: ignore + raw_result = await self._regenerate_keys_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1191,11 +1081,12 @@ async def begin_regenerate_keys( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -1206,17 +1097,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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_regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get_token( @@ -1233,12 +1120,11 @@ async def get_token( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthToken or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1252,22 +1138,20 @@ async def get_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthToken] = kwargs.pop("cls", None) - request = build_get_token_request( + _request = build_get_token_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1277,13 +1161,9 @@ async def get_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthToken", pipeline_response) + deserialized = self._deserialize("EndpointAuthToken", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/token" - } + return deserialized # type: ignore 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 3edc6c4bb6d..b492594d79f 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,22 +56,23 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.AmlOperation"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available Azure Machine Learning Workspaces 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) + Lists all of the available Azure Machine Learning Workspaces REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.AmlOperation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AmlOperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -79,14 +83,12 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.AmlOperation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -98,27 +100,26 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("AmlOperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -130,5 +131,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MachineLearningServices/operations"} 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 7a7f0546597..1e6ee169afc 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, @@ -36,6 +35,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,14 +66,15 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, workspace_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """List all the private endpoint connections associated with the workspace. + """Called by end-users to get all PE connections. + + Called by end-users to get all PE connections. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -83,7 +87,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,17 +98,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -116,13 +118,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -132,11 +133,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -149,30 +150,85 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections" - } + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Called by end-users to delete a PE connection. + + Called by end-users to delete a PE connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore @distributed_trace_async async def get( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the workspace. + """Called by end-users to get a PE connection. + + Called by end-users to get a PE connection. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,22 +242,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -211,16 +265,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload async def create_or_update( @@ -228,27 +278,29 @@ async def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, + body: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection + :param body: PrivateEndpointConnection object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :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: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -260,27 +312,29 @@ async def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO + :param body: PrivateEndpointConnection object. Required. + :type body: IO[bytes] :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: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -292,31 +346,30 @@ async def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + body: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection 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 + :param body: PrivateEndpointConnection object. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection or IO[bytes] :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -334,12 +387,12 @@ async def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") + _json = self._serialize.body(body, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -348,16 +401,14 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -367,78 +418,9 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Deletes the specified private endpoint connection associated with 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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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: str = 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, - private_endpoint_connection_name=private_endpoint_connection_name, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore 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 3e0bfcb8b50..a7385d1a302 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -17,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,67 +55,101 @@ def __init__(self, *args, **kwargs) -> None: 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_async - async def list( + @distributed_trace + def list( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources that need to be created for a workspace. + ) -> AsyncIterable["_models.PrivateLinkResource"]: + """Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". + + Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("PrivateLinkResourceListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources" - } + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) 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 3c7f29c1013..cd4a33ddbca 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,17 +21,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._quotas_operations import build_list_request, build_update_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +75,6 @@ async def update( :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: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: @@ -80,18 +82,17 @@ async def update( @overload async def update( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.UpdateWorkspaceQuotasResult: """Update quota for each VM family in workspace. :param location: The location for update quota is queried. Required. :type location: str :param parameters: Quota update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: @@ -99,24 +100,20 @@ async def update( @distributed_trace_async async def update( - self, location: str, parameters: Union[_models.QuotaUpdateParameters, IO], **kwargs: Any + self, location: str, parameters: Union[_models.QuotaUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.UpdateWorkspaceQuotasResult: """Update quota for each VM family in workspace. :param location: The location for update quota is queried. Required. :type location: str - :param parameters: Quota update parameters. Is either a QuotaUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.QuotaUpdateParameters 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 + :param parameters: Quota update parameters. Is either a QuotaUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.QuotaUpdateParameters or IO[bytes] :return: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,23 +136,21 @@ async def update( else: _json = self._serialize.body(parameters, "QuotaUpdateParameters") - request = build_update_request( + _request = build_update_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,16 +160,12 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("UpdateWorkspaceQuotasResult", pipeline_response) + deserialized = self._deserialize("UpdateWorkspaceQuotasResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas" - } + return deserialized # type: ignore @distributed_trace def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceQuota"]: @@ -182,7 +173,6 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceQ :param location: The location for which resource usage is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceQuota or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ResourceQuota] @@ -194,7 +184,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceQ api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListWorkspaceQuotas] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,16 +195,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ResourceQ def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -226,13 +214,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ListWorkspaceQuotas", pipeline_response) @@ -242,11 +229,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -258,7 +245,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas" - } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policies_operations.py new file mode 100644 index 00000000000..925f5778915 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policies_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Optional, Type, TypeVar +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.rest import AsyncHttpResponse, 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 ... import models as _models +from ...operations._rai_policies_operations import build_list_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RaiPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`rai_policies` 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, + endpoint_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RaiPolicyPropertiesBasicResource"]: + """List the specified Content Filters associated with the Azure OpenAI account. + + List the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiPolicyPropertiesBasicResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policy_operations.py new file mode 100644 index 00000000000..ae848352317 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_rai_policy_operations.py @@ -0,0 +1,504 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ...operations._rai_policy_operations import build_create_request, build_delete_request, build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RaiPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`rai_policy` 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") + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI account. + + Deletes the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicyPropertiesBasicResource: + """Gets the specified Content Filters associated with the Azure OpenAI account. + + Gets the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :return: RaiPolicyPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiPolicyPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: _models.RaiPolicyPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Is either a RaiPolicyPropertiesBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of AsyncLROPoller that returns either RaiPolicyPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiPolicyPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiPolicyPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.RaiPolicyPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 781e8951d29..a99f1e8a88a 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -41,6 +42,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,7 +75,6 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Registry List registries by subscription. - :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] @@ -82,7 +86,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Registry api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,15 +97,13 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Registry def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -113,13 +115,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -129,11 +130,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,10 +147,6 @@ async def get_next(next_link=None): 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, **kwargs: Any) -> AsyncIterable["_models.Registry"]: """List registries. @@ -159,7 +156,6 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: 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] @@ -171,7 +167,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -182,16 +178,14 @@ def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -203,13 +197,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -219,11 +212,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,14 +229,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,28 +244,31 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -289,12 +281,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -308,14 +300,6 @@ async def begin_delete(self, resource_group_name: str, registry_name: str, **kwa :param registry_name: Name of Azure Machine Learning 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: @@ -329,7 +313,7 @@ async def begin_delete(self, resource_group_name: str, registry_name: str, **kwa 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, api_version=api_version, @@ -338,11 +322,12 @@ async def begin_delete(self, resource_group_name: str, registry_name: str, **kwa params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -353,17 +338,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _models.Registry: @@ -377,12 +358,11 @@ async def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) :param registry_name: Name of Azure Machine Learning 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -396,21 +376,19 @@ async def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -420,16 +398,12 @@ async def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore @overload async def update( @@ -456,7 +430,6 @@ async def update( :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: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: @@ -467,7 +440,7 @@ async def update( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -483,11 +456,10 @@ async def update( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: @@ -498,7 +470,7 @@ async def update( self, resource_group_name: str, registry_name: str, - body: Union[_models.PartialRegistryPartialTrackedResource, IO], + body: Union[_models.PartialRegistryPartialTrackedResource, IO[bytes]], **kwargs: Any ) -> _models.Registry: """Update tags. @@ -512,18 +484,14 @@ async def update( Required. :type registry_name: str :param body: Details required to create the registry. Is either a - PartialRegistryPartialTrackedResource type or a IO type. Required. + PartialRegistryPartialTrackedResource type or a IO[bytes] 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 + IO[bytes] :return: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -546,7 +514,7 @@ async def update( else: _json = self._serialize.body(body, "PartialRegistryPartialTrackedResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -554,16 +522,14 @@ async def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -573,21 +539,17 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any - ) -> _models.Registry: - error_map = { + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -600,7 +562,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -610,7 +572,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "Registry") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -618,40 +580,35 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 response.status_code == 200: - deserialized = self._deserialize("Registry", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } - @overload async def begin_create_or_update( self, @@ -677,14 +634,6 @@ async def begin_create_or_update( :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] @@ -696,7 +645,7 @@ async def begin_create_or_update( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -712,18 +661,10 @@ async def begin_create_or_update( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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] @@ -732,7 +673,7 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Registry]: """Create or update registry. @@ -744,20 +685,9 @@ async def begin_create_or_update( :param registry_name: Name of Azure Machine Learning registry. This is case-insensitive. Required. :type registry_name: str - :param body: Details required to create the registry. Is either a Registry 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. + :param body: Details required to create the registry. Is either a Registry type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO[bytes] :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] @@ -784,12 +714,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -802,22 +733,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Registry].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}" - } + return AsyncLROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _remove_regions_initial( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any - ) -> Optional[_models.Registry]: - error_map = { + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,7 +759,7 @@ async def _remove_regions_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -840,7 +769,7 @@ async def _remove_regions_initial( else: _json = self._serialize.body(body, "Registry") - request = build_remove_regions_request( + _request = build_remove_regions_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -848,30 +777,29 @@ async def _remove_regions_initial( content_type=content_type, json=_json, content=_content, - template_url=self._remove_regions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Registry", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -879,14 +807,12 @@ async def _remove_regions_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _remove_regions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/removeRegions" - } + return deserialized # type: ignore @overload async def begin_remove_regions( @@ -913,14 +839,6 @@ async def begin_remove_regions( :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] @@ -932,7 +850,7 @@ async def begin_remove_regions( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -948,18 +866,10 @@ async def begin_remove_regions( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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] @@ -968,7 +878,7 @@ async def begin_remove_regions( @distributed_trace_async async def begin_remove_regions( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Registry]: """Remove regions from registry. @@ -980,20 +890,9 @@ async def begin_remove_regions( :param registry_name: Name of Azure Machine Learning registry. This is case-insensitive. Required. :type registry_name: str - :param body: Details required to create the registry. Is either a Registry 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. + :param body: Details required to create the registry. Is either a Registry type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO[bytes] :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] @@ -1020,12 +919,13 @@ async def begin_remove_regions( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1037,14 +937,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Registry].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_remove_regions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/removeRegions" - } + return AsyncLROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index b05e5f1c54e..4ed15603c61 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,6 @@ def list( :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] @@ -89,7 +93,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,18 +104,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +125,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -139,11 +140,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,14 +157,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,29 +172,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -210,12 +210,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -233,14 +233,6 @@ async def begin_delete( :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: @@ -254,7 +246,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -264,11 +256,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -279,17 +272,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -307,12 +296,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,22 +314,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,26 +337,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, registry_name: str, code_name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any - ) -> _models.CodeContainer: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +365,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -393,7 +375,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "CodeContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -402,29 +384,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -433,17 +415,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -472,14 +450,6 @@ async def begin_create_or_update( :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: @@ -493,7 +463,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, code_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -511,18 +481,10 @@ async def begin_create_or_update( :param code_name: Container name. Required. :type code_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -536,7 +498,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, code_name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CodeContainer]: """Create or update Code container. @@ -551,20 +513,9 @@ async def begin_create_or_update( :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 CodeContainer 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. + :param body: Container entity to create or update. Is either a CodeContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO[bytes] :return: An instance of AsyncLROPoller that returns either CodeContainer or the result of cls(response) :rtype: @@ -593,12 +544,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -611,14 +563,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CodeContainer].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}" - } + return AsyncLROPoller[_models.CodeContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 36b6109d658..7a5af1bcafb 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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_get_start_pending_upload_request, build_create_or_update_request, @@ -39,6 +40,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,7 +96,6 @@ def list( :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] @@ -103,7 +107,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -114,7 +118,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -123,12 +127,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -140,13 +142,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -156,11 +157,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -173,14 +174,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,30 +189,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -228,12 +228,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -253,14 +253,6 @@ async def begin_delete( :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: @@ -274,7 +266,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -285,11 +277,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -300,17 +293,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -330,12 +319,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -349,23 +337,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -375,16 +361,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -392,10 +374,10 @@ async def _create_or_update_initial( registry_name: str, code_name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any - ) -> _models.CodeVersion: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,7 +390,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -418,7 +400,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "CodeVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -428,29 +410,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -459,17 +441,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -501,14 +479,6 @@ async def begin_create_or_update( :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: @@ -523,7 +493,7 @@ async def begin_create_or_update( registry_name: str, code_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -543,18 +513,10 @@ async def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -569,7 +531,7 @@ async def begin_create_or_update( registry_name: str, code_name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CodeVersion]: """Create or update version. @@ -586,20 +548,9 @@ async def begin_create_or_update( :type code_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a CodeVersion 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. + :param body: Version entity to create or update. Is either a CodeVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO[bytes] :return: An instance of AsyncLROPoller that returns either CodeVersion or the result of cls(response) :rtype: @@ -629,12 +580,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -647,17 +599,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CodeVersion].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}" - } + return AsyncLROPoller[_models.CodeVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def create_or_get_start_pending_upload( @@ -690,7 +640,6 @@ async def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -703,7 +652,7 @@ async def create_or_get_start_pending_upload( registry_name: str, code_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -723,11 +672,10 @@ async def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -740,7 +688,7 @@ async def create_or_get_start_pending_upload( registry_name: str, code_name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a code asset to. @@ -757,18 +705,14 @@ async def create_or_get_start_pending_upload( :type code_name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,7 +735,7 @@ async def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -801,16 +745,14 @@ async def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -820,13 +762,9 @@ async def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 index b71a39207eb..e68b8b2d52b 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +82,6 @@ def list( :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] @@ -89,7 +93,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,18 +104,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -123,13 +125,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -139,11 +140,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,14 +157,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,29 +172,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -210,12 +210,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -233,14 +233,6 @@ async def begin_delete( :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: @@ -254,7 +246,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -264,11 +256,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -279,17 +272,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -307,12 +296,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,22 +314,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,26 +337,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, registry_name: str, component_name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any - ) -> _models.ComponentContainer: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,7 +365,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -393,7 +375,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "ComponentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -402,29 +384,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -433,17 +415,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -472,14 +450,6 @@ async def begin_create_or_update( :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: @@ -493,7 +463,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, component_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -511,18 +481,10 @@ async def begin_create_or_update( :param component_name: Container name. Required. :type component_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -536,7 +498,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, component_name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ComponentContainer]: """Create or update container. @@ -551,20 +513,9 @@ async def begin_create_or_update( :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 ComponentContainer 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. + :param body: Container entity to create or update. Is either a ComponentContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO[bytes] :return: An instance of AsyncLROPoller that returns either ComponentContainer or the result of cls(response) :rtype: @@ -593,12 +544,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -611,14 +563,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ComponentContainer].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}" - } + return AsyncLROPoller[_models.ComponentContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 07bb1a68854..fbf454207cd 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,7 +95,6 @@ def list( :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] @@ -102,7 +106,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +117,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -122,12 +126,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -139,13 +141,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -155,11 +156,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,14 +173,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,30 +188,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -227,12 +227,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -252,14 +252,6 @@ async def begin_delete( :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: @@ -273,7 +265,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -284,11 +276,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -299,17 +292,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -329,12 +318,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -348,23 +336,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,16 +360,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -391,10 +373,10 @@ async def _create_or_update_initial( registry_name: str, component_name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any - ) -> _models.ComponentVersion: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -407,7 +389,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -417,7 +399,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "ComponentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -427,29 +409,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -458,17 +440,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -500,14 +478,6 @@ async def begin_create_or_update( :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: @@ -522,7 +492,7 @@ async def begin_create_or_update( registry_name: str, component_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -542,18 +512,10 @@ async def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -568,7 +530,7 @@ async def begin_create_or_update( registry_name: str, component_name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ComponentVersion]: """Create or update version. @@ -585,20 +547,9 @@ async def begin_create_or_update( :type component_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ComponentVersion 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. + :param body: Version entity to create or update. Is either a ComponentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO[bytes] :return: An instance of AsyncLROPoller that returns either ComponentVersion or the result of cls(response) :rtype: @@ -628,12 +579,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -646,14 +598,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ComponentVersion].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}" - } + return AsyncLROPoller[_models.ComponentVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_containers_operations.py index 190fee60ac7..f7d70f4d4d2 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._registry_data_containers_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,6 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataContainer or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.DataContainer] @@ -97,7 +101,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,19 +112,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -132,13 +134,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DataContainerResourceArmPaginatedResult", pipeline_response) @@ -148,11 +149,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,14 +166,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, registry_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,29 +181,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -219,12 +219,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -242,14 +242,6 @@ async def begin_delete( :type registry_name: str :param name: Container name. Required. :type 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: @@ -263,7 +255,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -273,11 +265,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -288,17 +281,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}/data/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -316,12 +305,11 @@ async def get( :type registry_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,22 +323,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,26 +346,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, registry_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any - ) -> _models.DataContainer: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +374,7 @@ async def _create_or_update_initial( api_version: str = 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.DataContainer] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -402,7 +384,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "DataContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -411,29 +393,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DataContainer", 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") @@ -442,17 +424,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/data/{name}" - } - @overload async def begin_create_or_update( self, @@ -481,14 +459,6 @@ async def begin_create_or_update( :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 DataContainer or the result of cls(response) :rtype: @@ -502,7 +472,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -520,18 +490,10 @@ async def begin_create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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 DataContainer or the result of cls(response) :rtype: @@ -545,7 +507,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DataContainer]: """Create or update container. @@ -560,20 +522,9 @@ async def begin_create_or_update( :type registry_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a DataContainer type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataContainer 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. + :param body: Container entity to create or update. Is either a DataContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataContainer or IO[bytes] :return: An instance of AsyncLROPoller that returns either DataContainer or the result of cls(response) :rtype: @@ -602,12 +553,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -620,14 +572,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DataContainer].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}/data/{name}" - } + return AsyncLROPoller[_models.DataContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_references_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_references_operations.py new file mode 100644 index 00000000000..09c067d2dbe --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_references_operations.py @@ -0,0 +1,216 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ... import models as _models +from ...operations._registry_data_references_operations import build_get_blob_reference_sas_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class RegistryDataReferencesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`registry_data_references` 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") + + @overload + async def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: _models.GetBlobReferenceSASRequestDto, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: Union[_models.GetBlobReferenceSASRequestDto, IO[bytes]], + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Is either a GetBlobReferenceSASRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto or + IO[bytes] + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.GetBlobReferenceSASResponseDto] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "GetBlobReferenceSASRequestDto") + + _request = build_get_blob_reference_sas_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("GetBlobReferenceSASResponseDto", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_versions_operations.py index 5971067bd75..83342090dd8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_registry_data_versions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._registry_data_versions_operations import ( build_create_or_get_start_pending_upload_request, build_create_or_update_request, @@ -39,6 +40,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -103,7 +108,6 @@ def list( ListViewType.All]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 DataVersionBase or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.DataVersionBase] @@ -115,7 +119,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -126,7 +130,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -137,12 +141,10 @@ def prepare_request(next_link=None): tags=tags, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -154,13 +156,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("DataVersionBaseResourceArmPaginatedResult", pipeline_response) @@ -170,11 +171,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,14 +188,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, registry_name: str, name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -206,30 +203,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -242,12 +242,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -267,14 +267,6 @@ async def begin_delete( :type 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: @@ -288,7 +280,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -299,11 +291,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -314,17 +307,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}/data/{name}/versions/{version}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -344,12 +333,11 @@ async def get( :type 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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,23 +351,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -389,16 +375,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -406,10 +388,10 @@ async def _create_or_update_initial( registry_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any - ) -> _models.DataVersionBase: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +404,7 @@ async def _create_or_update_initial( api_version: str = 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.DataVersionBase] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -432,7 +414,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "DataVersionBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -442,29 +424,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DataVersionBase", 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") @@ -473,17 +455,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/data/{name}/versions/{version}" - } - @overload async def begin_create_or_update( self, @@ -515,14 +493,6 @@ async def begin_create_or_update( :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 DataVersionBase or the result of cls(response) :rtype: @@ -537,7 +507,7 @@ async def begin_create_or_update( registry_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -557,18 +527,10 @@ async def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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 DataVersionBase or the result of cls(response) :rtype: @@ -583,7 +545,7 @@ async def begin_create_or_update( registry_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DataVersionBase]: """Create or update version. @@ -600,20 +562,9 @@ async def begin_create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a DataVersionBase type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase 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. + :param body: Version entity to create or update. Is either a DataVersionBase type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase or IO[bytes] :return: An instance of AsyncLROPoller that returns either DataVersionBase or the result of cls(response) :rtype: @@ -643,12 +594,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -661,17 +613,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DataVersionBase].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}/data/{name}/versions/{version}" - } + return AsyncLROPoller[_models.DataVersionBase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def create_or_get_start_pending_upload( @@ -704,7 +654,6 @@ async def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -717,7 +666,7 @@ async def create_or_get_start_pending_upload( registry_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -737,11 +686,10 @@ async def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -754,7 +702,7 @@ async def create_or_get_start_pending_upload( registry_name: str, name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a data asset to. @@ -771,18 +719,14 @@ async def create_or_get_start_pending_upload( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +749,7 @@ async def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -815,16 +759,14 @@ async def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -834,13 +776,9 @@ async def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 index 0e5795fb7a7..7ac1f4b82e4 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,6 @@ 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 - :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: @@ -98,7 +102,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,19 +113,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +135,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -149,11 +150,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -166,14 +167,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,29 +182,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -220,12 +220,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -243,14 +243,6 @@ async def begin_delete( :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: @@ -264,7 +256,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -274,11 +266,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -289,17 +282,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -317,12 +306,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,22 +324,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,26 +347,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, registry_name: str, environment_name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any - ) -> _models.EnvironmentContainer: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -393,7 +375,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -403,7 +385,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "EnvironmentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -412,29 +394,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -443,17 +425,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -482,14 +460,6 @@ async def begin_create_or_update( :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: @@ -503,7 +473,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, environment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -521,18 +491,10 @@ async def begin_create_or_update( :param environment_name: Container name. Required. :type environment_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -546,7 +508,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, environment_name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.EnvironmentContainer]: """Create or update container. @@ -562,19 +524,8 @@ async def begin_create_or_update( :param environment_name: Container name. Required. :type environment_name: str :param body: Container entity to create or update. Is either a EnvironmentContainer 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. + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO[bytes] :return: An instance of AsyncLROPoller that returns either EnvironmentContainer or the result of cls(response) :rtype: @@ -603,12 +554,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -621,14 +573,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.EnvironmentContainer].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}" - } + return AsyncLROPoller[_models.EnvironmentContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 10560e9f5fd..4f2206e85b4 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,7 +99,6 @@ 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 - :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] @@ -106,7 +110,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -117,7 +121,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -127,12 +131,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -144,13 +146,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -160,11 +161,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,14 +178,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -196,30 +193,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -232,12 +232,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -257,14 +257,6 @@ async def begin_delete( :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: @@ -278,7 +270,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -289,11 +281,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -304,17 +297,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -334,12 +323,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,23 +341,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,16 +365,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -396,10 +378,10 @@ async def _create_or_update_initial( registry_name: str, environment_name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any - ) -> _models.EnvironmentVersion: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +394,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -422,7 +404,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "EnvironmentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -432,29 +414,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -463,17 +445,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -505,14 +483,6 @@ async def begin_create_or_update( :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: @@ -527,7 +497,7 @@ async def begin_create_or_update( registry_name: str, environment_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -547,18 +517,10 @@ async def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -573,7 +535,7 @@ async def begin_create_or_update( registry_name: str, environment_name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.EnvironmentVersion]: """Create or update version. @@ -590,20 +552,9 @@ async def begin_create_or_update( :type environment_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a EnvironmentVersion 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. + :param body: Version entity to create or update. Is either a EnvironmentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO[bytes] :return: An instance of AsyncLROPoller that returns either EnvironmentVersion or the result of cls(response) :rtype: @@ -633,12 +584,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -651,14 +603,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.EnvironmentVersion].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}" - } + return AsyncLROPoller[_models.EnvironmentVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index a8e788a7e80..c7194cd4d4e 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,7 +90,6 @@ 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 - :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] @@ -97,7 +101,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -108,19 +112,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -132,13 +134,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -148,11 +149,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,14 +166,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,29 +181,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -219,12 +219,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -242,14 +242,6 @@ async def begin_delete( :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: @@ -263,7 +255,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -273,11 +265,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -288,17 +281,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -316,12 +305,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,22 +323,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -360,26 +346,22 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, registry_name: str, model_name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any - ) -> _models.ModelContainer: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -392,7 +374,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -402,7 +384,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "ModelContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -411,29 +393,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -442,17 +424,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -481,14 +459,6 @@ async def begin_create_or_update( :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: @@ -502,7 +472,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, model_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -520,18 +490,10 @@ async def begin_create_or_update( :param model_name: Container name. Required. :type model_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -545,7 +507,7 @@ async def begin_create_or_update( resource_group_name: str, registry_name: str, model_name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ModelContainer]: """Create or update model container. @@ -560,20 +522,9 @@ async def begin_create_or_update( :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 ModelContainer 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. + :param body: Container entity to create or update. Is either a ModelContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO[bytes] :return: An instance of AsyncLROPoller that returns either ModelContainer or the result of cls(response) :rtype: @@ -602,12 +553,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -620,14 +572,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ModelContainer].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}" - } + return AsyncLROPoller[_models.ModelContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 512c6ba1df7..0c2f21a4e7a 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ 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_get_start_pending_upload_request, build_create_or_update_request, @@ -39,6 +40,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -109,7 +114,6 @@ 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 - :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] @@ -121,7 +125,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +136,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -146,12 +150,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -163,13 +165,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _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) @@ -179,11 +180,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,14 +197,10 @@ async def get_next(next_link=None): 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 + async def _delete_initial( self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -215,30 +212,33 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -251,12 +251,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -276,14 +276,6 @@ async def begin_delete( :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: @@ -297,7 +289,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -308,11 +300,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -323,17 +316,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -353,12 +342,11 @@ async def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -372,23 +360,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -398,16 +384,12 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, @@ -415,10 +397,10 @@ async def _create_or_update_initial( registry_name: str, model_name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any - ) -> _models.ModelVersion: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +413,7 @@ async def _create_or_update_initial( api_version: str = 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -441,7 +423,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "ModelVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -451,29 +433,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -482,17 +464,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -524,14 +502,6 @@ async def begin_create_or_update( :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: @@ -546,7 +516,7 @@ async def begin_create_or_update( registry_name: str, model_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -566,18 +536,10 @@ async def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -592,7 +554,7 @@ async def begin_create_or_update( registry_name: str, model_name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ModelVersion]: """Create or update version. @@ -609,20 +571,9 @@ async def begin_create_or_update( :type model_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ModelVersion 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. + :param body: Version entity to create or update. Is either a ModelVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO[bytes] :return: An instance of AsyncLROPoller that returns either ModelVersion or the result of cls(response) :rtype: @@ -652,12 +603,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -670,17 +622,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ModelVersion].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}" - } + return AsyncLROPoller[_models.ModelVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def create_or_get_start_pending_upload( @@ -713,7 +663,6 @@ async def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -726,7 +675,7 @@ async def create_or_get_start_pending_upload( registry_name: str, model_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -746,11 +695,10 @@ async def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -763,7 +711,7 @@ async def create_or_get_start_pending_upload( registry_name: str, model_name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a model asset to. @@ -780,18 +728,14 @@ async def create_or_get_start_pending_upload( :type model_name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -814,7 +758,7 @@ async def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -824,16 +768,14 @@ async def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -843,13 +785,9 @@ async def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 56e5acb5880..acda8a826be 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._schedules_operations import ( build_create_or_update_request, build_delete_request, @@ -38,6 +39,10 @@ build_list_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,7 +89,6 @@ def list( :param list_view_type: Status filter for schedule. Known values are: "EnabledOnly", "DisabledOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleListViewType - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Schedule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Schedule] @@ -96,7 +100,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScheduleResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,19 +111,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -131,13 +133,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleResourceArmPaginatedResult", pipeline_response) @@ -147,11 +148,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -164,14 +165,10 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -183,29 +180,32 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -218,12 +218,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" - } + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -240,14 +240,6 @@ async def begin_delete( :type workspace_name: str :param name: Schedule name. Required. :type 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: @@ -261,7 +253,7 @@ async def begin_delete( 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 + raw_result = await self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -271,11 +263,12 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -286,17 +279,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].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/workspaces/{workspaceName}/schedules/{name}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.Schedule: @@ -311,12 +300,11 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** :type workspace_name: str :param name: Schedule name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,22 +318,20 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -355,21 +341,22 @@ async def get(self, resource_group_name: str, workspace_name: str, name: str, ** error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = self._deserialize("Schedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" - } + return deserialized # type: ignore async def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, name: str, body: Union[_models.Schedule, IO], **kwargs: Any - ) -> _models.Schedule: - error_map = { + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.Schedule, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +369,7 @@ async def _create_or_update_initial( api_version: str = 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.Schedule] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -392,7 +379,7 @@ async def _create_or_update_initial( else: _json = self._serialize.body(body, "Schedule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -401,29 +388,29 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Schedule", 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") @@ -432,17 +419,13 @@ async def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/schedules/{name}" - } - @overload async def begin_create_or_update( self, @@ -470,14 +453,6 @@ async def begin_create_or_update( :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 Schedule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Schedule] @@ -490,7 +465,7 @@ async def begin_create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -507,18 +482,10 @@ async def begin_create_or_update( :param name: Schedule name. Required. :type name: str :param body: Schedule definition. Required. - :type body: IO + :type body: IO[bytes] :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 Schedule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Schedule] @@ -527,7 +494,12 @@ async def begin_create_or_update( @distributed_trace_async async def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, name: str, body: Union[_models.Schedule, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.Schedule, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Schedule]: """Create or update schedule. @@ -540,19 +512,8 @@ async def begin_create_or_update( :type workspace_name: str :param name: Schedule name. Required. :type name: str - :param body: Schedule definition. Is either a Schedule type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.Schedule 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. + :param body: Schedule definition. Is either a Schedule type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Schedule or IO[bytes] :return: An instance of AsyncLROPoller that returns either Schedule or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.Schedule] @@ -580,12 +541,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = self._deserialize("Schedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -598,14 +560,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Schedule].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}/schedules/{name}" - } + return AsyncLROPoller[_models.Schedule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_serverless_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_serverless_endpoints_operations.py new file mode 100644 index 00000000000..6c4b9105740 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/aio/operations/_serverless_endpoints_operations.py @@ -0,0 +1,1081 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, 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, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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 ...operations._serverless_endpoints_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_keys_request, + build_list_request, + build_regenerate_keys_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServerlessEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.aio.MachineLearningServicesMgmtClient`'s + :attr:`serverless_endpoints` 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, **kwargs: Any + ) -> AsyncIterable["_models.ServerlessEndpoint"]: + """List Serverless Endpoints. + + List Serverless Endpoints. + + :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 + :return: An iterator like instance of either ServerlessEndpoint or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServerlessEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ServerlessEndpointTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete Serverless Endpoint (asynchronous). + + Delete Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.ServerlessEndpoint: + """Get Serverless Endpoint. + + Get Serverless Endpoint. + + :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 name: Serverless Endpoint name. Required. + :type name: str + :return: ServerlessEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServerlessEndpoint] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("ServerlessEndpoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSkuAndIdentity") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ServerlessEndpoint] = 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, + workspace_name=workspace_name, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ServerlessEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServerlessEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ServerlessEndpoint") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.ServerlessEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Is either a + ServerlessEndpoint type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint or IO[bytes] + :return: An instance of AsyncLROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ServerlessEndpoint] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ServerlessEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServerlessEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def list_keys( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.EndpointAuthKeys: + """List EndpointAuthKeys for an Endpoint using Key-based authentication. + + List EndpointAuthKeys for an Endpoint using Key-based authentication. + + :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 name: Serverless Endpoint name. Required. + :type name: str + :return: EndpointAuthKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) + + _request = build_list_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointAuthKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _regenerate_keys_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RegenerateEndpointKeysRequest") + + _request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.RegenerateEndpointKeysRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointAuthKeys] = 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._regenerate_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointAuthKeys].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.EndpointAuthKeys]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 a8392c59646..6b371047f90 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._usages_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +62,6 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: :param location: The location for which resource usage is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Usage or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Usage] @@ -71,7 +73,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,16 +84,14 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Usage"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -103,13 +103,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ListUsagesResult", pipeline_response) @@ -119,11 +118,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -135,7 +134,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages" - } 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 dd19432ccc8..eabf6dfb2b2 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._virtual_machine_sizes_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,12 +59,11 @@ async def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSize :param location: The location upon which virtual-machine-sizes is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineSizeListResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -75,20 +77,18 @@ async def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSize api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -98,13 +98,9 @@ async def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSize error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes" - } + return deserialized # type: ignore 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 1c796d31405..239252d3c47 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,25 +18,34 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, 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._workspace_connections_operations import ( build_create_request, build_delete_request, build_get_request, build_list_request, + build_list_secrets_request, + build_test_connection_request, + build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,100 +69,329 @@ def __init__(self, *args, **kwargs) -> None: 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, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceConnectionPropertiesV2BasicResource"]: + """Lists all the available machine learning workspaces connections under the specified workspace. + + Lists all the available machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param target: Target of the workspace connection. Default value is None. + :type target: str + :param category: Category of the workspace connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either WorkspaceConnectionPropertiesV2BasicResource or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete machine learning workspaces connections by name. + + Delete machine learning workspaces connections by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Lists machine learning workspaces connections by name. + + Lists machine learning workspaces connections by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + @overload - async def create( + async def update( self, resource_group_name: str, workspace_name: str, connection_name: str, - parameters: _models.WorkspaceConnectionPropertiesV2BasicResource, + body: Optional[_models.WorkspaceConnectionUpdateParameter] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Required. - :type parameters: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :param body: Parameters for workspace connection update. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter :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: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def create( + async def update( self, resource_group_name: str, workspace_name: str, connection_name: str, - parameters: IO, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Required. - :type parameters: IO + :param body: Parameters for workspace connection update. Default value is None. + :type body: IO[bytes] :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: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def create( + async def update( self, resource_group_name: str, workspace_name: str, connection_name: str, - parameters: Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO], + body: Optional[Union[_models.WorkspaceConnectionUpdateParameter, IO[bytes]]] = None, **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Is either a - WorkspaceConnectionPropertiesV2BasicResource type or a IO type. Required. - :type parameters: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource 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 + :param body: Parameters for workspace connection update. Is either a + WorkspaceConnectionUpdateParameter type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter or + IO[bytes] :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -170,12 +409,15 @@ async def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(parameters, "WorkspaceConnectionPropertiesV2BasicResource") + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionUpdateParameter") + else: + _json = None - request = build_create_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, @@ -184,16 +426,14 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -203,36 +443,112 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[_models.WorkspaceConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new workspace connection. Default value is + None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: The object for creating or updating a new workspace connection. Default value is + None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace_async - async def get( - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + async def create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """get. + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param body: The object for creating or updating a new workspace connection. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or + IO[bytes] :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -240,28 +556,41 @@ async def get( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = 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.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - request = build_get_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -271,36 +600,35 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } + return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def list_secrets( self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any - ) -> None: - """delete. + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """List all the secrets of a machine learning workspaces connections. + + List all the secrets of a machine learning workspaces connections. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -312,74 +640,49 @@ async def delete( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + 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( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } + return deserialized # type: ignore - @distributed_trace - def list( + async def _test_connection_initial( self, resource_group_name: str, workspace_name: str, - target: Optional[str] = None, - category: Optional[str] = None, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, **kwargs: Any - ) -> AsyncIterable["_models.WorkspaceConnectionPropertiesV2BasicResource"]: - """list. - - :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 target: Target of the workspace connection. Default value is None. - :type target: str - :param category: Category of the workspace connection. Default value is None. - :type category: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceConnectionPropertiesV2BasicResource or - the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) - - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -387,68 +690,202 @@ def list( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - target=target, - category=category, - 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) + api_version: str = 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[AsyncIterator[bytes]] = kwargs.pop("cls", None) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionPropertiesV2BasicResource") 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 + _json = None - async def extract_data(pipeline_response): - deserialized = self._deserialize( - "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", 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) + _request = build_test_connection_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - async def get_next(next_link=None): - request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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 response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - return AsyncItemPaged(get_next, extract_data) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" - } + @overload + async def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[_models.WorkspaceConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or + IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._test_connection_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 4de434394f7..5a0e820b9bc 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,16 +20,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ... import models as _models -from ..._vendor import _convert_request from ...operations._workspace_features_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,7 +66,6 @@ def list( :type resource_group_name: str :param workspace_name: Name of Azure Machine Learning workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AmlUserFeature or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.AmlUserFeature] @@ -75,7 +77,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAmlUserFeatureResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -86,17 +88,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +108,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ListAmlUserFeatureResult", pipeline_response) @@ -124,11 +123,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,7 +139,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/features" - } 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 1195fbbbd75..2feb61467b6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import AsyncHttpResponse, 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 @@ -30,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._workspaces_operations import ( build_create_or_update_request, build_delete_request, @@ -48,6 +49,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,21 +76,332 @@ def __init__(self, *args, **kwargs) -> None: 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, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Workspace"]: + """Lists all the available machine learning workspaces under the specified subscription. + + Lists all the available machine learning workspaces under the specified subscription. + + :param kind: Kind of workspace. Default value is None. + :type kind: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param ai_capabilities: Default value is None. + :type ai_capabilities: str + :return: An iterator like instance of either Workspace or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.Workspace"]: + """Lists all the available machine learning workspaces under the specified resource group. + + Lists all the available machine learning workspaces under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param kind: Kind of workspace. Default value is None. + :type kind: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param ai_capabilities: Default value is None. + :type ai_capabilities: str + :return: An iterator like instance of either Workspace or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", 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) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + async def _delete_initial( + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + force_to_purge=force_to_purge, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a machine learning workspace. + + Deletes a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param force_to_purge: Flag to indicate delete is a purge request. Default value is False. + :type force_to_purge: bool + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + force_to_purge=force_to_purge, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + @distributed_trace_async async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: """Gets the properties of the specified machine learning workspace. + Gets the properties of the specified machine learning 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Workspace :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,21 +415,19 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -123,21 +437,21 @@ async def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return deserialized # type: ignore - async def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> Optional[_models.Workspace]: - error_map = { + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + body: Union[_models.WorkspaceUpdateParameters, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -150,17 +464,17 @@ async def _create_or_update_initial( api_version: str = 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.Workspace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(parameters, "Workspace") + _json = self._serialize.body(body, "WorkspaceUpdateParameters") - request = build_create_or_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -168,69 +482,59 @@ async def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Workspace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: _models.Workspace, + body: _models.WorkspaceUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + """Updates a machine learning workspace with the specified parameters. + + Updates a machine learning workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for creating or updating a machine learning workspace. - Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace + :param body: The parameters for updating a machine learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters :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 Workspace or the result of cls(response) :rtype: @@ -239,36 +543,29 @@ async def begin_create_or_update( """ @overload - async def begin_create_or_update( + async def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + """Updates a machine learning workspace with the specified parameters. + + Updates a machine learning workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for creating or updating a machine learning workspace. - Required. - :type parameters: IO + :param body: The parameters for updating a machine learning workspace. Required. + :type body: IO[bytes] :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 Workspace or the result of cls(response) :rtype: @@ -277,30 +574,25 @@ async def begin_create_or_update( """ @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + body: Union[_models.WorkspaceUpdateParameters, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + """Updates a machine learning workspace with the specified parameters. + + Updates a machine learning workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for creating or updating a machine learning workspace. Is - either a Workspace type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace 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. + :param body: The parameters for updating a machine learning workspace. Is either a + WorkspaceUpdateParameters type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) :rtype: @@ -317,10 +609,10 @@ async def begin_create_or_update( 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( + raw_result = await self._update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -328,12 +620,13 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -343,138 +636,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Workspace].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}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_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: str = 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, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, + return AsyncLROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a machine learning 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 - :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: str = 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, - workspace_name=workspace_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, **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/workspaces/{workspaceName}" - } - - async def _update_initial( - self, - resource_group_name: str, - workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], - **kwargs: Any - ) -> Optional[_models.Workspace]: - error_map = { + async def _create_or_update_initial( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,17 +662,17 @@ async def _update_initial( api_version: str = 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.Workspace]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(parameters, "WorkspaceUpdateParameters") + _json = self._serialize.body(body, "Workspace") - request = build_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -505,68 +680,64 @@ async def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Workspace", pipeline_response) + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, workspace_name: str, - parameters: _models.WorkspaceUpdateParameters, + body: _models.Workspace, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Updates a machine learning workspace with the specified parameters. + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters + :param body: The parameters for creating or updating a machine learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace :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 Workspace or the result of cls(response) :rtype: @@ -575,35 +746,29 @@ async def begin_update( """ @overload - async def begin_update( + async def begin_create_or_update( self, resource_group_name: str, workspace_name: str, - parameters: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Updates a machine learning workspace with the specified parameters. + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Required. - :type parameters: IO + :param body: The parameters for creating or updating a machine learning workspace. Required. + :type body: IO[bytes] :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 Workspace or the result of cls(response) :rtype: @@ -611,35 +776,22 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], - **kwargs: Any + @distributed_trace_async + async def begin_create_or_update( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Workspace]: - """Updates a machine learning workspace with the specified parameters. + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Is either a - WorkspaceUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters 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. + :param body: The parameters for creating or updating a machine learning workspace. Is either a + Workspace type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace or IO[bytes] :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) :rtype: @@ -656,10 +808,10 @@ async def begin_update( 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( + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -667,134 +819,42 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + 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( + return AsyncLROPoller[_models.Workspace].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/workspaces/{workspaceName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Workspace"]: - """Lists all the available machine learning workspaces under the specified resource group. - - :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 Workspace or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceListResult] = 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_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - skip=skip, - api_version=api_version, - template_url=self.list_by_resource_group.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("WorkspaceListResult", 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" - } + return AsyncLROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _diagnose_initial( self, resource_group_name: str, workspace_name: str, - parameters: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, + body: Optional[Union[_models.DiagnoseWorkspaceParameters, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.DiagnoseResponseResult]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -807,20 +867,20 @@ async def _diagnose_initial( api_version: str = 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.DiagnoseResponseResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - if parameters is not None: - _json = self._serialize.body(parameters, "DiagnoseWorkspaceParameters") + if body is not None: + _json = self._serialize.body(body, "DiagnoseWorkspaceParameters") else: _json = None - request = build_diagnose_request( + _request = build_diagnose_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -828,49 +888,46 @@ async def _diagnose_initial( content_type=content_type, json=_json, content=_content, - template_url=self._diagnose_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DiagnoseResponseResult", 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _diagnose_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose" - } + return deserialized # type: ignore @overload async def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[_models.DiagnoseWorkspaceParameters] = None, + body: Optional[_models.DiagnoseWorkspaceParameters] = None, *, content_type: str = "application/json", **kwargs: Any @@ -882,21 +939,13 @@ async def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Default value is None. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters + :param body: The parameter of diagnosing workspace health. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters :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 DiagnoseResponseResult or the result of cls(response) :rtype: @@ -909,7 +958,7 @@ async def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[IO] = None, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -921,21 +970,13 @@ async def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Default value is None. - :type parameters: IO + :param body: The parameter of diagnosing workspace health. Default value is None. + :type body: IO[bytes] :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 DiagnoseResponseResult or the result of cls(response) :rtype: @@ -948,7 +989,7 @@ async def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, + body: Optional[Union[_models.DiagnoseWorkspaceParameters, IO[bytes]]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.DiagnoseResponseResult]: """Diagnose workspace setup issue. @@ -958,22 +999,11 @@ async def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Is either a - DiagnoseWorkspaceParameters type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters 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. + :param body: The parameter of diagnosing workspace health. Is either a + DiagnoseWorkspaceParameters type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either DiagnoseResponseResult or the result of cls(response) :rtype: @@ -993,7 +1023,7 @@ async def begin_diagnose( raw_result = await self._diagnose_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1001,12 +1031,13 @@ async def begin_diagnose( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiagnoseResponseResult", pipeline_response) + deserialized = self._deserialize("DiagnoseResponseResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1018,17 +1049,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.DiagnoseResponseResult].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_diagnose.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose" - } + return AsyncLROPoller[_models.DiagnoseResponseResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def list_keys( @@ -1037,17 +1066,19 @@ async def list_keys( """Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry. + Lists all the keys associated with this workspace. This includes keys for the storage account, + app insights and password for container registry. + :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListWorkspaceKeysResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ListWorkspaceKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1061,260 +1092,53 @@ async def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListWorkspaceKeysResult] = kwargs.pop("cls", None) - request = build_list_keys_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("ListWorkspaceKeysResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys" - } - - async def _resync_keys_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_resync_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._resync_keys_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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) - - if cls: - return cls(pipeline_response, None, {}) - - _resync_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" - } - - @distributed_trace_async - async def begin_resync_keys( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Resync all the keys associated with this workspace. This includes keys for the storage account, - app insights and password for container registry. - - :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 - :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: str = 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._resync_keys_initial( # type: ignore - resource_group_name=resource_group_name, - workspace_name=workspace_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, **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_resync_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" - } - - @distributed_trace - def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Workspace"]: - """Lists all the available machine learning workspaces under the specified 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 Workspace or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceListResult] = 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("WorkspaceListResult", 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) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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 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 + deserialized = self._deserialize("ListWorkspaceKeysResult", pipeline_response.http_response) - return AsyncItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" - } + return deserialized # type: ignore @distributed_trace_async async def list_notebook_access_token( self, resource_group_name: str, workspace_name: str, **kwargs: Any ) -> _models.NotebookAccessTokenResult: - """return notebook access token and refresh token. + """Get Azure Machine Learning Workspace notebook access token. + + Get Azure Machine Learning Workspace notebook access token. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: NotebookAccessTokenResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1328,21 +1152,19 @@ async def list_notebook_access_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NotebookAccessTokenResult] = kwargs.pop("cls", None) - request = build_list_notebook_access_token_request( + _request = build_list_notebook_access_token_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_notebook_access_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1352,21 +1174,31 @@ async def list_notebook_access_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NotebookAccessTokenResult", pipeline_response) + deserialized = self._deserialize("NotebookAccessTokenResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_notebook_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" - } + return deserialized # type: ignore - async def _prepare_notebook_initial( + @distributed_trace_async + async def list_notebook_keys( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Optional[_models.NotebookResourceInfo]: - error_map = { + ) -> _models.ListNotebookKeysResult: + """Lists keys of Azure Machine Learning Workspaces notebook. + + Lists keys of Azure Machine Learning Workspaces notebook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: ListNotebookKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1378,134 +1210,117 @@ async def _prepare_notebook_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.NotebookResourceInfo]] = kwargs.pop("cls", None) + cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) - request = build_prepare_notebook_request( + _request = build_list_notebook_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._prepare_notebook_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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 = None - if response.status_code == 200: - deserialized = self._deserialize("NotebookResourceInfo", pipeline_response) + deserialized = self._deserialize("ListNotebookKeysResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _prepare_notebook_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook" - } + return deserialized # type: ignore @distributed_trace_async - async def begin_prepare_notebook( + async def list_storage_account_keys( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.NotebookResourceInfo]: - """Prepare a notebook. + ) -> _models.ListStorageAccountKeysResult: + """Lists keys of Azure Machine Learning Workspace's storage account. + + Lists keys of Azure Machine Learning Workspace's storage account. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_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 NotebookResourceInfo or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.NotebookResourceInfo] + :return: ListStorageAccountKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NotebookResourceInfo] = 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._prepare_notebook_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NotebookResourceInfo", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + _request = build_list_storage_account_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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 + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) - begin_prepare_notebook.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook" - } + deserialized = self._deserialize("ListStorageAccountKeysResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async - async def list_storage_account_keys( + async def list_outbound_network_dependencies_endpoints( # pylint: disable=name-too-long self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ListStorageAccountKeysResult: - """List storage account keys of a workspace. + ) -> _models.ExternalFQDNResponse: + """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. + + Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListStorageAccountKeysResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult + :return: ExternalFQDNResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1517,23 +1332,21 @@ async def list_storage_account_keys( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) - request = build_list_storage_account_keys_request( + _request = build_list_outbound_network_dependencies_endpoints_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_storage_account_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1543,34 +1356,17 @@ async def list_storage_account_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListStorageAccountKeysResult", pipeline_response) + deserialized = self._deserialize("ExternalFQDNResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_storage_account_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys" - } + return deserialized # type: ignore - @distributed_trace_async - async def list_notebook_keys( + async def _prepare_notebook_initial( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ListNotebookKeysResult: - """List keys of a notebook. - - :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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListNotebookKeysResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1582,64 +1378,116 @@ async def list_notebook_keys( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_list_notebook_keys_request( + _request = build_prepare_notebook_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_notebook_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ListNotebookKeysResult", pipeline_response) + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - list_notebook_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" - } + return deserialized # type: ignore @distributed_trace_async - async def list_outbound_network_dependencies_endpoints( + async def begin_prepare_notebook( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ExternalFQDNResponse: - """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + ) -> AsyncLROPoller[_models.NotebookResourceInfo]: + """Prepare Azure Machine Learning Workspace's notebook resource. - Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + Prepare Azure Machine Learning Workspace's notebook resource. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExternalFQDNResponse or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse + :return: An instance of AsyncLROPoller that returns either NotebookResourceInfo or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.machinelearningservices.models.NotebookResourceInfo] :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotebookResourceInfo] = 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._prepare_notebook_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("NotebookResourceInfo", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.NotebookResourceInfo].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NotebookResourceInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _resync_keys_initial( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1651,39 +1499,104 @@ async def list_outbound_network_dependencies_endpoints( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_list_outbound_network_dependencies_endpoints_request( + _request = build_resync_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ExternalFQDNResponse", pipeline_response) + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_resync_keys( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. + + Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :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 {}) - return deserialized + api_version: str = 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._resync_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - list_outbound_network_dependencies_endpoints.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" - } + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 339c533836e..5ea58d2bfd7 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 @@ -6,26 +6,32 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import AADAuthTypeWorkspaceConnectionProperties from ._models_py3 import AKS from ._models_py3 import AKSSchema from ._models_py3 import AKSSchemaProperties +from ._models_py3 import AccessKeyAuthTypeWorkspaceConnectionProperties +from ._models_py3 import AccountApiKeys +from ._models_py3 import AccountKeyAuthTypeWorkspaceConnectionProperties from ._models_py3 import AccountKeyDatastoreCredentials from ._models_py3 import AccountKeyDatastoreSecrets from ._models_py3 import AcrDetails +from ._models_py3 import ActualCapacityInfo from ._models_py3 import AksComputeSecrets from ._models_py3 import AksComputeSecretsProperties from ._models_py3 import AksNetworkingConfiguration +from ._models_py3 import AllFeatures from ._models_py3 import AllNodes from ._models_py3 import AmlCompute from ._models_py3 import AmlComputeNodeInformation from ._models_py3 import AmlComputeNodesInformation from ._models_py3 import AmlComputeProperties from ._models_py3 import AmlComputeSchema -from ._models_py3 import AmlOperation -from ._models_py3 import AmlOperationDisplay -from ._models_py3 import AmlOperationListResult from ._models_py3 import AmlToken +from ._models_py3 import AmlTokenComputeIdentity from ._models_py3 import AmlUserFeature +from ._models_py3 import AnonymousAccessCredential +from ._models_py3 import ApiKeyAuthWorkspaceConnectionProperties from ._models_py3 import ArmResourceId from ._models_py3 import AssetBase from ._models_py3 import AssetContainer @@ -45,20 +51,32 @@ from ._models_py3 import AzureBlobDatastore from ._models_py3 import AzureDataLakeGen1Datastore from ._models_py3 import AzureDataLakeGen2Datastore +from ._models_py3 import AzureDatastore +from ._models_py3 import AzureDevOpsWebhook from ._models_py3 import AzureFileDatastore +from ._models_py3 import AzureOpenAiFineTuning +from ._models_py3 import AzureOpenAiHyperParameters from ._models_py3 import BanditPolicy from ._models_py3 import BatchDeployment +from ._models_py3 import BatchDeploymentConfiguration from ._models_py3 import BatchDeploymentProperties from ._models_py3 import BatchDeploymentTrackedResourceArmPaginatedResult from ._models_py3 import BatchEndpoint from ._models_py3 import BatchEndpointDefaults from ._models_py3 import BatchEndpointProperties from ._models_py3 import BatchEndpointTrackedResourceArmPaginatedResult +from ._models_py3 import BatchPipelineComponentDeploymentConfiguration from ._models_py3 import BatchRetrySettings from ._models_py3 import BayesianSamplingAlgorithm from ._models_py3 import BindOptions from ._models_py3 import BlobReferenceForConsumptionDto from ._models_py3 import BuildContext +from ._models_py3 import CapabilityHost +from ._models_py3 import CapabilityHostProperties +from ._models_py3 import CapacityConfig +from ._models_py3 import CategoricalDataDriftMetricThreshold +from ._models_py3 import CategoricalDataQualityMetricThreshold +from ._models_py3 import CategoricalPredictionDriftMetricThreshold from ._models_py3 import CertificateDatastoreCredentials from ._models_py3 import CertificateDatastoreSecrets from ._models_py3 import Classification @@ -71,6 +89,9 @@ from ._models_py3 import CodeVersion from ._models_py3 import CodeVersionProperties from ._models_py3 import CodeVersionResourceArmPaginatedResult +from ._models_py3 import CognitiveServiceEndpointDeploymentResourceProperties +from ._models_py3 import CognitiveServicesSku +from ._models_py3 import Collection from ._models_py3 import ColumnTransformer from ._models_py3 import CommandJob from ._models_py3 import CommandJobLimits @@ -83,6 +104,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 @@ -94,32 +116,49 @@ from ._models_py3 import ComputeInstanceSchema from ._models_py3 import ComputeInstanceSshSettings from ._models_py3 import ComputeInstanceVersion +from ._models_py3 import ComputeRecurrenceSchedule from ._models_py3 import ComputeResource from ._models_py3 import ComputeResourceSchema +from ._models_py3 import ComputeRuntimeDto from ._models_py3 import ComputeSchedules from ._models_py3 import ComputeSecrets from ._models_py3 import ComputeStartStopSchedule from ._models_py3 import ContainerResourceRequirements from ._models_py3 import ContainerResourceSettings +from ._models_py3 import ContentSafety +from ._models_py3 import ContentSafetyEndpointDeploymentResourceProperties +from ._models_py3 import ContentSafetyEndpointResourceProperties from ._models_py3 import CosmosDbSettings +from ._models_py3 import CreateMonitorAction from ._models_py3 import Cron from ._models_py3 import CronTrigger from ._models_py3 import CustomForecastHorizon +from ._models_py3 import CustomKeys +from ._models_py3 import CustomKeysWorkspaceConnectionProperties +from ._models_py3 import CustomMetricThreshold +from ._models_py3 import CustomModelFineTuning from ._models_py3 import CustomModelJobInput from ._models_py3 import CustomModelJobOutput +from ._models_py3 import CustomMonitoringSignal 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 DataCollector from ._models_py3 import DataContainer from ._models_py3 import DataContainerProperties from ._models_py3 import DataContainerResourceArmPaginatedResult +from ._models_py3 import DataDriftMetricThresholdBase +from ._models_py3 import DataDriftMonitoringSignal from ._models_py3 import DataFactory from ._models_py3 import DataLakeAnalytics from ._models_py3 import DataLakeAnalyticsSchema from ._models_py3 import DataLakeAnalyticsSchemaProperties from ._models_py3 import DataPathAssetReference +from ._models_py3 import DataQualityMetricThresholdBase +from ._models_py3 import DataQualityMonitoringSignal +from ._models_py3 import DataReferenceCredential from ._models_py3 import DataVersionBase from ._models_py3 import DataVersionBaseProperties from ._models_py3 import DataVersionBaseResourceArmPaginatedResult @@ -134,9 +173,15 @@ from ._models_py3 import DatastoreResourceArmPaginatedResult from ._models_py3 import DatastoreSecrets from ._models_py3 import DefaultScaleSettings +from ._models_py3 import DeltaModelCurrentState +from ._models_py3 import DeltaModelListRequest +from ._models_py3 import DeltaModelModifyRequest +from ._models_py3 import DeltaModelStatusRequest +from ._models_py3 import DeltaModelStatusResponse from ._models_py3 import DeploymentLogs from ._models_py3 import DeploymentLogsRequest from ._models_py3 import DeploymentResourceConfiguration +from ._models_py3 import DestinationAsset from ._models_py3 import DiagnoseRequestProperties from ._models_py3 import DiagnoseResponseResult from ._models_py3 import DiagnoseResponseResultValue @@ -144,14 +189,32 @@ from ._models_py3 import DiagnoseWorkspaceParameters from ._models_py3 import DistributionConfiguration from ._models_py3 import Docker +from ._models_py3 import DockerCredential 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 EndpointDeploymentModel from ._models_py3 import EndpointDeploymentPropertiesBase +from ._models_py3 import EndpointDeploymentResourceProperties +from ._models_py3 import EndpointDeploymentResourcePropertiesBasicResource +from ._models_py3 import EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult +from ._models_py3 import EndpointKeys +from ._models_py3 import EndpointModelDeprecationProperties +from ._models_py3 import EndpointModelProperties +from ._models_py3 import EndpointModelSkuCapacityProperties +from ._models_py3 import EndpointModelSkuProperties +from ._models_py3 import EndpointModelSkuRateLimitProperties +from ._models_py3 import EndpointModelSkuRateLimitRulePatternProperties +from ._models_py3 import EndpointModelSkuRateLimitRuleProperties +from ._models_py3 import EndpointModels from ._models_py3 import EndpointPropertiesBase +from ._models_py3 import EndpointResourceProperties +from ._models_py3 import EndpointResourcePropertiesBasicResource +from ._models_py3 import EndpointResourcePropertiesBasicResourceArmPaginatedResult from ._models_py3 import EndpointScheduleAction from ._models_py3 import EnvironmentContainer from ._models_py3 import EnvironmentContainerProperties @@ -169,17 +232,52 @@ from ._models_py3 import FQDNEndpoint from ._models_py3 import FQDNEndpointDetail from ._models_py3 import FQDNEndpoints -from ._models_py3 import FQDNEndpointsProperties +from ._models_py3 import FQDNEndpointsPropertyBag +from ._models_py3 import Feature +from ._models_py3 import FeatureAttributionDriftMonitoringSignal +from ._models_py3 import FeatureAttributionMetricThreshold +from ._models_py3 import FeatureImportanceSettings +from ._models_py3 import FeatureProperties +from ._models_py3 import FeatureResourceArmPaginatedResult +from ._models_py3 import FeatureStoreSettings +from ._models_py3 import FeatureSubset +from ._models_py3 import FeatureWindow +from ._models_py3 import FeaturesetContainer +from ._models_py3 import FeaturesetContainerProperties +from ._models_py3 import FeaturesetContainerResourceArmPaginatedResult +from ._models_py3 import FeaturesetSpecification +from ._models_py3 import FeaturesetVersion +from ._models_py3 import FeaturesetVersionBackfillRequest +from ._models_py3 import FeaturesetVersionBackfillResponse +from ._models_py3 import FeaturesetVersionProperties +from ._models_py3 import FeaturesetVersionResourceArmPaginatedResult +from ._models_py3 import FeaturestoreEntityContainer +from ._models_py3 import FeaturestoreEntityContainerProperties +from ._models_py3 import FeaturestoreEntityContainerResourceArmPaginatedResult +from ._models_py3 import FeaturestoreEntityVersion +from ._models_py3 import FeaturestoreEntityVersionProperties +from ._models_py3 import FeaturestoreEntityVersionResourceArmPaginatedResult from ._models_py3 import FeaturizationSettings +from ._models_py3 import FineTuningJob +from ._models_py3 import FineTuningVertical +from ._models_py3 import FixedInputData from ._models_py3 import FlavorData from ._models_py3 import ForecastHorizon from ._models_py3 import Forecasting from ._models_py3 import ForecastingSettings from ._models_py3 import ForecastingTrainingSettings +from ._models_py3 import FqdnOutboundRule +from ._models_py3 import GetBlobReferenceForConsumptionDto +from ._models_py3 import GetBlobReferenceSASRequestDto +from ._models_py3 import GetBlobReferenceSASResponseDto from ._models_py3 import GridSamplingAlgorithm +from ._models_py3 import GroupEnvironmentConfiguration +from ._models_py3 import GroupModelConfiguration +from ._models_py3 import GroupStatus from ._models_py3 import HDInsight from ._models_py3 import HDInsightProperties from ._models_py3 import HDInsightSchema +from ._models_py3 import IPRule from ._models_py3 import IdAssetReference from ._models_py3 import IdentityConfiguration from ._models_py3 import IdentityForCmk @@ -201,7 +299,17 @@ from ._models_py3 import ImageObjectDetectionBase from ._models_py3 import ImageSweepSettings from ._models_py3 import ImageVertical +from ._models_py3 import IndexColumn from ._models_py3 import InferenceContainerProperties +from ._models_py3 import InferenceEndpoint +from ._models_py3 import InferenceEndpointProperties +from ._models_py3 import InferenceEndpointTrackedResourceArmPaginatedResult +from ._models_py3 import InferenceGroup +from ._models_py3 import InferenceGroupProperties +from ._models_py3 import InferenceGroupTrackedResourceArmPaginatedResult +from ._models_py3 import InferencePool +from ._models_py3 import InferencePoolProperties +from ._models_py3 import InferencePoolTrackedResourceArmPaginatedResult from ._models_py3 import InstanceTypeSchema from ._models_py3 import InstanceTypeSchemaResources from ._models_py3 import JobBase @@ -211,12 +319,16 @@ from ._models_py3 import JobLimits from ._models_py3 import JobOutput from ._models_py3 import JobResourceConfiguration +from ._models_py3 import JobResources from ._models_py3 import JobScheduleAction from ._models_py3 import JobService +from ._models_py3 import JupyterKernelConfig +from ._models_py3 import KeyVaultProperties from ._models_py3 import Kubernetes from ._models_py3 import KubernetesOnlineDeployment from ._models_py3 import KubernetesProperties from ._models_py3 import KubernetesSchema +from ._models_py3 import LakeHouseArtifact from ._models_py3 import ListAmlUserFeatureResult from ._models_py3 import ListNotebookKeysResult from ._models_py3 import ListStorageAccountKeysResult @@ -229,19 +341,47 @@ from ._models_py3 import MLTableData from ._models_py3 import MLTableJobInput from ._models_py3 import MLTableJobOutput +from ._models_py3 import ManagedComputeIdentity from ._models_py3 import ManagedIdentity from ._models_py3 import ManagedIdentityAuthTypeWorkspaceConnectionProperties +from ._models_py3 import ManagedIdentityCredential +from ._models_py3 import ManagedNetworkProvisionOptions +from ._models_py3 import ManagedNetworkProvisionStatus +from ._models_py3 import ManagedNetworkSettings from ._models_py3 import ManagedOnlineDeployment +from ._models_py3 import ManagedOnlineEndpointDeploymentResourceProperties +from ._models_py3 import ManagedOnlineEndpointResourceProperties +from ._models_py3 import ManagedResourceGroupAssignedIdentities +from ._models_py3 import ManagedResourceGroupSettings from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MarketplacePlan +from ._models_py3 import MarketplaceSubscription +from ._models_py3 import MarketplaceSubscriptionProperties +from ._models_py3 import MarketplaceSubscriptionResourceArmPaginatedResult +from ._models_py3 import MaterializationComputeResource +from ._models_py3 import MaterializationSettings from ._models_py3 import MedianStoppingPolicy from ._models_py3 import ModelContainer from ._models_py3 import ModelContainerProperties from ._models_py3 import ModelContainerResourceArmPaginatedResult +from ._models_py3 import ModelSettings from ._models_py3 import ModelVersion from ._models_py3 import ModelVersionProperties from ._models_py3 import ModelVersionResourceArmPaginatedResult +from ._models_py3 import MonitorComputeConfigurationBase +from ._models_py3 import MonitorComputeIdentityBase +from ._models_py3 import MonitorDefinition +from ._models_py3 import MonitorEmailNotificationSettings +from ._models_py3 import MonitorNotificationSettings +from ._models_py3 import MonitorServerlessSparkCompute +from ._models_py3 import MonitoringFeatureFilterBase +from ._models_py3 import MonitoringInputDataBase +from ._models_py3 import MonitoringSignalBase +from ._models_py3 import MonitoringTarget +from ._models_py3 import MonitoringThreshold from ._models_py3 import Mpi from ._models_py3 import NCrossValidations +from ._models_py3 import NetworkAcls from ._models_py3 import NlpVertical from ._models_py3 import NlpVerticalFeaturizationSettings from ._models_py3 import NlpVerticalLimitSettings @@ -252,7 +392,14 @@ from ._models_py3 import NotebookAccessTokenResult from ._models_py3 import NotebookPreparationError from ._models_py3 import NotebookResourceInfo +from ._models_py3 import NotificationSetting +from ._models_py3 import NumericalDataDriftMetricThreshold +from ._models_py3 import NumericalDataQualityMetricThreshold +from ._models_py3 import NumericalPredictionDriftMetricThreshold +from ._models_py3 import OAuth2AuthTypeWorkspaceConnectionProperties from ._models_py3 import Objective +from ._models_py3 import OneLakeArtifact +from ._models_py3 import OneLakeDatastore from ._models_py3 import OnlineDeployment from ._models_py3 import OnlineDeploymentProperties from ._models_py3 import OnlineDeploymentTrackedResourceArmPaginatedResult @@ -261,6 +408,15 @@ from ._models_py3 import OnlineEndpointTrackedResourceArmPaginatedResult from ._models_py3 import OnlineRequestSettings from ._models_py3 import OnlineScaleSettings +from ._models_py3 import OpenAIEndpointDeploymentResourceProperties +from ._models_py3 import OpenAIEndpointResourceProperties +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OsPatchingStatus +from ._models_py3 import OutboundRule +from ._models_py3 import OutboundRuleBasicResource +from ._models_py3 import OutboundRuleListResult from ._models_py3 import OutputPathAssetReference from ._models_py3 import PATAuthTypeWorkspaceConnectionProperties from ._models_py3 import PaginatedComputeResourcesList @@ -270,6 +426,7 @@ from ._models_py3 import PartialMinimalTrackedResource from ._models_py3 import PartialMinimalTrackedResourceWithIdentity from ._models_py3 import PartialMinimalTrackedResourceWithSku +from ._models_py3 import PartialMinimalTrackedResourceWithSkuAndIdentity from ._models_py3 import PartialRegistryPartialTrackedResource from ._models_py3 import PartialSku from ._models_py3 import Password @@ -278,22 +435,42 @@ from ._models_py3 import PendingUploadResponseDto from ._models_py3 import PersonalComputeInstanceSettings from ._models_py3 import PipelineJob +from ._models_py3 import PredictionDriftMetricThresholdBase +from ._models_py3 import PredictionDriftMonitoringSignal from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateEndpointDestination +from ._models_py3 import PrivateEndpointOutboundRule from ._models_py3 import PrivateEndpointResource from ._models_py3 import PrivateLinkResource from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProbeSettings +from ._models_py3 import PropertiesBase +from ._models_py3 import ProxyResource from ._models_py3 import PyTorch +from ._models_py3 import QueueSettings from ._models_py3 import QuotaBaseProperties from ._models_py3 import QuotaUpdateParameters +from ._models_py3 import RaiBlocklistConfig +from ._models_py3 import RaiBlocklistItemBulkRequest +from ._models_py3 import RaiBlocklistItemProperties +from ._models_py3 import RaiBlocklistItemPropertiesBasicResource +from ._models_py3 import RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult +from ._models_py3 import RaiBlocklistProperties +from ._models_py3 import RaiBlocklistPropertiesBasicResource +from ._models_py3 import RaiBlocklistPropertiesBasicResourceArmPaginatedResult +from ._models_py3 import RaiPolicyContentFilter +from ._models_py3 import RaiPolicyProperties +from ._models_py3 import RaiPolicyPropertiesBasicResource +from ._models_py3 import RaiPolicyPropertiesBasicResourceArmPaginatedResult from ._models_py3 import RandomSamplingAlgorithm from ._models_py3 import Recurrence from ._models_py3 import RecurrenceSchedule from ._models_py3 import RecurrenceTrigger from ._models_py3 import RegenerateEndpointKeysRequest +from ._models_py3 import RegenerateServiceAccountKeyContent from ._models_py3 import Registry from ._models_py3 import RegistryListCredentialsResult from ._models_py3 import RegistryPartialManagedServiceIdentity @@ -303,20 +480,26 @@ from ._models_py3 import RegistryTrackedResourceArmPaginatedResult from ._models_py3 import Regression from ._models_py3 import RegressionTrainingSettings +from ._models_py3 import RequestConfiguration +from ._models_py3 import RequestLogging +from ._models_py3 import ResizeSchema from ._models_py3 import Resource from ._models_py3 import ResourceBase from ._models_py3 import ResourceConfiguration from ._models_py3 import ResourceId from ._models_py3 import ResourceName from ._models_py3 import ResourceQuota +from ._models_py3 import RollingInputData from ._models_py3 import Route from ._models_py3 import SASAuthTypeWorkspaceConnectionProperties +from ._models_py3 import SASCredential from ._models_py3 import SASCredentialDto from ._models_py3 import SamplingAlgorithm from ._models_py3 import SasDatastoreCredentials from ._models_py3 import SasDatastoreSecrets from ._models_py3 import ScaleSettings from ._models_py3 import ScaleSettingsInformation +from ._models_py3 import ScaleUnitConfiguration from ._models_py3 import Schedule from ._models_py3 import ScheduleActionBase from ._models_py3 import ScheduleBase @@ -325,9 +508,24 @@ from ._models_py3 import ScriptReference from ._models_py3 import ScriptsToExecute from ._models_py3 import Seasonality +from ._models_py3 import SecretExpiry +from ._models_py3 import ServerlessComputeSettings +from ._models_py3 import ServerlessEndpoint +from ._models_py3 import ServerlessEndpointCapacityReservation +from ._models_py3 import ServerlessEndpointContentSafety +from ._models_py3 import ServerlessEndpointInferenceEndpoint +from ._models_py3 import ServerlessEndpointModelSettings +from ._models_py3 import ServerlessEndpointProperties +from ._models_py3 import ServerlessEndpointResourceProperties +from ._models_py3 import ServerlessEndpointTrackedResourceArmPaginatedResult +from ._models_py3 import ServerlessInferenceEndpoint +from ._models_py3 import ServerlessOffer from ._models_py3 import ServiceManagedResourcesSettings +from ._models_py3 import ServicePrincipalAuthTypeWorkspaceConnectionProperties from ._models_py3 import ServicePrincipalDatastoreCredentials from ._models_py3 import ServicePrincipalDatastoreSecrets +from ._models_py3 import ServiceTagDestination +from ._models_py3 import ServiceTagOutboundRule from ._models_py3 import SetupScripts from ._models_py3 import SharedPrivateLinkResource from ._models_py3 import Sku @@ -335,9 +533,19 @@ 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 SpeechEndpointDeploymentResourceProperties +from ._models_py3 import SpeechEndpointResourceProperties from ._models_py3 import SslConfiguration from ._models_py3 import StackEnsembleSettings +from ._models_py3 import StaticInputData from ._models_py3 import StorageAccountDetails +from ._models_py3 import StringArmPaginatedResult +from ._models_py3 import StringKeyValuePair from ._models_py3 import SweepJob from ._models_py3 import SweepJobLimits from ._models_py3 import SynapseSpark @@ -357,6 +565,7 @@ from ._models_py3 import TextClassificationMultilabel from ._models_py3 import TextNer from ._models_py3 import TmpfsOptions +from ._models_py3 import TopNFeaturesByAttribution from ._models_py3 import TrackedResource from ._models_py3 import TrainingSettings from ._models_py3 import TrialComponent @@ -391,27 +600,45 @@ from ._models_py3 import VirtualMachineSshCredentials from ._models_py3 import VolumeDefinition from ._models_py3 import VolumeOptions +from ._models_py3 import Webhook from ._models_py3 import Workspace +from ._models_py3 import WorkspaceConnectionAccessKey +from ._models_py3 import WorkspaceConnectionAccountKey +from ._models_py3 import WorkspaceConnectionApiKey from ._models_py3 import WorkspaceConnectionManagedIdentity +from ._models_py3 import WorkspaceConnectionOAuth2 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 WorkspaceConnectionUpdateParameter from ._models_py3 import WorkspaceConnectionUsernamePassword +from ._models_py3 import WorkspaceHubConfig from ._models_py3 import WorkspaceListResult +from ._models_py3 import WorkspacePrivateEndpointResource from ._models_py3 import WorkspaceUpdateParameters +from ._machine_learning_services_mgmt_client_enums import ActionType from ._machine_learning_services_mgmt_client_enums import AllocationState +from ._machine_learning_services_mgmt_client_enums import AllowedContentLevel 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 AuthMode 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 BatchDeploymentConfigurationType from ._machine_learning_services_mgmt_client_enums import BatchLoggingLevel from ._machine_learning_services_mgmt_client_enums import BatchOutputAction from ._machine_learning_services_mgmt_client_enums import BillingCurrency from ._machine_learning_services_mgmt_client_enums import BlockedTransformers from ._machine_learning_services_mgmt_client_enums import Caching +from ._machine_learning_services_mgmt_client_enums import CapabilityHostKind +from ._machine_learning_services_mgmt_client_enums import CapabilityHostProvisioningState +from ._machine_learning_services_mgmt_client_enums import CategoricalDataDriftMetric +from ._machine_learning_services_mgmt_client_enums import CategoricalDataQualityMetric +from ._machine_learning_services_mgmt_client_enums import CategoricalPredictionDriftMetric from ._machine_learning_services_mgmt_client_enums import ClassificationModels from ._machine_learning_services_mgmt_client_enums import ClassificationMultilabelPrimaryMetrics from ._machine_learning_services_mgmt_client_enums import ClassificationPrimaryMetrics @@ -419,28 +646,46 @@ from ._machine_learning_services_mgmt_client_enums import ComputeInstanceAuthorizationType from ._machine_learning_services_mgmt_client_enums import ComputeInstanceState from ._machine_learning_services_mgmt_client_enums import ComputePowerAction +from ._machine_learning_services_mgmt_client_enums import ComputeRecurrenceFrequency +from ._machine_learning_services_mgmt_client_enums import ComputeTriggerType from ._machine_learning_services_mgmt_client_enums import ComputeType +from ._machine_learning_services_mgmt_client_enums import ComputeWeekDay from ._machine_learning_services_mgmt_client_enums import ConnectionAuthType from ._machine_learning_services_mgmt_client_enums import ConnectionCategory +from ._machine_learning_services_mgmt_client_enums import ConnectionGroup from ._machine_learning_services_mgmt_client_enums import ContainerType +from ._machine_learning_services_mgmt_client_enums import ContentSafetyStatus from ._machine_learning_services_mgmt_client_enums import CreatedByType from ._machine_learning_services_mgmt_client_enums import CredentialsType +from ._machine_learning_services_mgmt_client_enums import DataAvailabilityStatus +from ._machine_learning_services_mgmt_client_enums import DataCollectionMode +from ._machine_learning_services_mgmt_client_enums import DataReferenceCredentialType from ._machine_learning_services_mgmt_client_enums import DataType from ._machine_learning_services_mgmt_client_enums import DatastoreType +from ._machine_learning_services_mgmt_client_enums import DefaultActionType +from ._machine_learning_services_mgmt_client_enums import DefaultResourceProvisioningState +from ._machine_learning_services_mgmt_client_enums import DeploymentModelVersionUpgradeOption from ._machine_learning_services_mgmt_client_enums import DeploymentProvisioningState from ._machine_learning_services_mgmt_client_enums import DiagnoseResultLevel from ._machine_learning_services_mgmt_client_enums import DistributionType from ._machine_learning_services_mgmt_client_enums import EarlyTerminationPolicyType from ._machine_learning_services_mgmt_client_enums import EgressPublicNetworkAccessType +from ._machine_learning_services_mgmt_client_enums import EmailNotificationEnableType from ._machine_learning_services_mgmt_client_enums import EncryptionStatus from ._machine_learning_services_mgmt_client_enums import EndpointAuthMode 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 EndpointServiceConnectionStatus +from ._machine_learning_services_mgmt_client_enums import EndpointType 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 FeatureAttributionMetric +from ._machine_learning_services_mgmt_client_enums import FeatureDataType +from ._machine_learning_services_mgmt_client_enums import FeatureImportanceMode 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 FineTuningTaskType +from ._machine_learning_services_mgmt_client_enums import FirewallSku from ._machine_learning_services_mgmt_client_enums import ForecastHorizonMode from ._machine_learning_services_mgmt_client_enums import ForecastingModels from ._machine_learning_services_mgmt_client_enums import ForecastingPrimaryMetrics @@ -449,48 +694,81 @@ from ._machine_learning_services_mgmt_client_enums import ImageType 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 IsolationMode 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 JobStatus +from ._machine_learning_services_mgmt_client_enums import JobTier from ._machine_learning_services_mgmt_client_enums import JobType from ._machine_learning_services_mgmt_client_enums import KeyType from ._machine_learning_services_mgmt_client_enums import LearningRateScheduler 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 ManagedNetworkStatus +from ._machine_learning_services_mgmt_client_enums import ManagedPERequirement +from ._machine_learning_services_mgmt_client_enums import ManagedPEStatus from ._machine_learning_services_mgmt_client_enums import ManagedServiceIdentityType +from ._machine_learning_services_mgmt_client_enums import MarketplaceSubscriptionProvisioningState +from ._machine_learning_services_mgmt_client_enums import MarketplaceSubscriptionStatus +from ._machine_learning_services_mgmt_client_enums import MaterializationStoreType +from ._machine_learning_services_mgmt_client_enums import MlflowAutologger +from ._machine_learning_services_mgmt_client_enums import ModelLifecycleStatus +from ._machine_learning_services_mgmt_client_enums import ModelProvider from ._machine_learning_services_mgmt_client_enums import ModelSize +from ._machine_learning_services_mgmt_client_enums import ModelTaskType +from ._machine_learning_services_mgmt_client_enums import MonitorComputeIdentityType +from ._machine_learning_services_mgmt_client_enums import MonitorComputeType +from ._machine_learning_services_mgmt_client_enums import MonitoringFeatureDataType +from ._machine_learning_services_mgmt_client_enums import MonitoringFeatureFilterType +from ._machine_learning_services_mgmt_client_enums import MonitoringInputDataType +from ._machine_learning_services_mgmt_client_enums import MonitoringNotificationType +from ._machine_learning_services_mgmt_client_enums import MonitoringSignalType from ._machine_learning_services_mgmt_client_enums import MountAction +from ._machine_learning_services_mgmt_client_enums import MountMode from ._machine_learning_services_mgmt_client_enums import MountState 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 NodeState from ._machine_learning_services_mgmt_client_enums import NodesValueType +from ._machine_learning_services_mgmt_client_enums import NumericalDataDriftMetric +from ._machine_learning_services_mgmt_client_enums import NumericalDataQualityMetric +from ._machine_learning_services_mgmt_client_enums import NumericalPredictionDriftMetric from ._machine_learning_services_mgmt_client_enums import ObjectDetectionPrimaryMetrics +from ._machine_learning_services_mgmt_client_enums import OneLakeArtifactType from ._machine_learning_services_mgmt_client_enums import OperatingSystemType from ._machine_learning_services_mgmt_client_enums import OperationName from ._machine_learning_services_mgmt_client_enums import OperationStatus from ._machine_learning_services_mgmt_client_enums import OperationTrigger from ._machine_learning_services_mgmt_client_enums import OrderString +from ._machine_learning_services_mgmt_client_enums import Origin from ._machine_learning_services_mgmt_client_enums import OsType from ._machine_learning_services_mgmt_client_enums import OutputDeliveryMode +from ._machine_learning_services_mgmt_client_enums import PatchStatus from ._machine_learning_services_mgmt_client_enums import PendingUploadCredentialType from ._machine_learning_services_mgmt_client_enums import PendingUploadType +from ._machine_learning_services_mgmt_client_enums import PoolProvisioningState 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 from ._machine_learning_services_mgmt_client_enums import PublicNetworkAccessType from ._machine_learning_services_mgmt_client_enums import QuotaUnit +from ._machine_learning_services_mgmt_client_enums import RaiPolicyContentSource +from ._machine_learning_services_mgmt_client_enums import RaiPolicyMode +from ._machine_learning_services_mgmt_client_enums import RaiPolicyType from ._machine_learning_services_mgmt_client_enums import RandomSamplingAlgorithmRule from ._machine_learning_services_mgmt_client_enums import RecurrenceFrequency from ._machine_learning_services_mgmt_client_enums import ReferenceType from ._machine_learning_services_mgmt_client_enums import RegressionModels from ._machine_learning_services_mgmt_client_enums import RegressionPrimaryMetrics from ._machine_learning_services_mgmt_client_enums import RemoteLoginPortPublicAccess +from ._machine_learning_services_mgmt_client_enums import RollingRateType +from ._machine_learning_services_mgmt_client_enums import RuleAction +from ._machine_learning_services_mgmt_client_enums import RuleCategory +from ._machine_learning_services_mgmt_client_enums import RuleStatus +from ._machine_learning_services_mgmt_client_enums import RuleType from ._machine_learning_services_mgmt_client_enums import SamplingAlgorithmType from ._machine_learning_services_mgmt_client_enums import ScaleType from ._machine_learning_services_mgmt_client_enums import ScheduleActionType @@ -500,17 +778,22 @@ from ._machine_learning_services_mgmt_client_enums import ScheduleStatus from ._machine_learning_services_mgmt_client_enums import SeasonalityMode from ._machine_learning_services_mgmt_client_enums import SecretsType +from ._machine_learning_services_mgmt_client_enums import ServerlessEndpointState +from ._machine_learning_services_mgmt_client_enums import ServerlessInferenceEndpointAuthMode +from ._machine_learning_services_mgmt_client_enums import ServiceAccountKeyName from ._machine_learning_services_mgmt_client_enums import ServiceDataAccessAuthIdentity from ._machine_learning_services_mgmt_client_enums import ShortSeriesHandlingConfiguration 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 StochasticOptimizer from ._machine_learning_services_mgmt_client_enums import StorageAccountType +from ._machine_learning_services_mgmt_client_enums import SystemDatastoresAuthMode 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 @@ -523,35 +806,41 @@ from ._machine_learning_services_mgmt_client_enums import VMPriceOSType from ._machine_learning_services_mgmt_client_enums import VMTier 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 WebhookType from ._machine_learning_services_mgmt_client_enums import WeekDay from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AADAuthTypeWorkspaceConnectionProperties", "AKS", "AKSSchema", "AKSSchemaProperties", + "AccessKeyAuthTypeWorkspaceConnectionProperties", + "AccountApiKeys", + "AccountKeyAuthTypeWorkspaceConnectionProperties", "AccountKeyDatastoreCredentials", "AccountKeyDatastoreSecrets", "AcrDetails", + "ActualCapacityInfo", "AksComputeSecrets", "AksComputeSecretsProperties", "AksNetworkingConfiguration", + "AllFeatures", "AllNodes", "AmlCompute", "AmlComputeNodeInformation", "AmlComputeNodesInformation", "AmlComputeProperties", "AmlComputeSchema", - "AmlOperation", - "AmlOperationDisplay", - "AmlOperationListResult", "AmlToken", + "AmlTokenComputeIdentity", "AmlUserFeature", + "AnonymousAccessCredential", + "ApiKeyAuthWorkspaceConnectionProperties", "ArmResourceId", "AssetBase", "AssetContainer", @@ -571,20 +860,32 @@ "AzureBlobDatastore", "AzureDataLakeGen1Datastore", "AzureDataLakeGen2Datastore", + "AzureDatastore", + "AzureDevOpsWebhook", "AzureFileDatastore", + "AzureOpenAiFineTuning", + "AzureOpenAiHyperParameters", "BanditPolicy", "BatchDeployment", + "BatchDeploymentConfiguration", "BatchDeploymentProperties", "BatchDeploymentTrackedResourceArmPaginatedResult", "BatchEndpoint", "BatchEndpointDefaults", "BatchEndpointProperties", "BatchEndpointTrackedResourceArmPaginatedResult", + "BatchPipelineComponentDeploymentConfiguration", "BatchRetrySettings", "BayesianSamplingAlgorithm", "BindOptions", "BlobReferenceForConsumptionDto", "BuildContext", + "CapabilityHost", + "CapabilityHostProperties", + "CapacityConfig", + "CategoricalDataDriftMetricThreshold", + "CategoricalDataQualityMetricThreshold", + "CategoricalPredictionDriftMetricThreshold", "CertificateDatastoreCredentials", "CertificateDatastoreSecrets", "Classification", @@ -597,6 +898,9 @@ "CodeVersion", "CodeVersionProperties", "CodeVersionResourceArmPaginatedResult", + "CognitiveServiceEndpointDeploymentResourceProperties", + "CognitiveServicesSku", + "Collection", "ColumnTransformer", "CommandJob", "CommandJobLimits", @@ -609,6 +913,7 @@ "Compute", "ComputeInstance", "ComputeInstanceApplication", + "ComputeInstanceAutologgerSettings", "ComputeInstanceConnectivityEndpoints", "ComputeInstanceContainer", "ComputeInstanceCreatedBy", @@ -620,32 +925,49 @@ "ComputeInstanceSchema", "ComputeInstanceSshSettings", "ComputeInstanceVersion", + "ComputeRecurrenceSchedule", "ComputeResource", "ComputeResourceSchema", + "ComputeRuntimeDto", "ComputeSchedules", "ComputeSecrets", "ComputeStartStopSchedule", "ContainerResourceRequirements", "ContainerResourceSettings", + "ContentSafety", + "ContentSafetyEndpointDeploymentResourceProperties", + "ContentSafetyEndpointResourceProperties", "CosmosDbSettings", + "CreateMonitorAction", "Cron", "CronTrigger", "CustomForecastHorizon", + "CustomKeys", + "CustomKeysWorkspaceConnectionProperties", + "CustomMetricThreshold", + "CustomModelFineTuning", "CustomModelJobInput", "CustomModelJobOutput", + "CustomMonitoringSignal", "CustomNCrossValidations", "CustomSeasonality", "CustomService", "CustomTargetLags", "CustomTargetRollingWindowSize", + "DataCollector", "DataContainer", "DataContainerProperties", "DataContainerResourceArmPaginatedResult", + "DataDriftMetricThresholdBase", + "DataDriftMonitoringSignal", "DataFactory", "DataLakeAnalytics", "DataLakeAnalyticsSchema", "DataLakeAnalyticsSchemaProperties", "DataPathAssetReference", + "DataQualityMetricThresholdBase", + "DataQualityMonitoringSignal", + "DataReferenceCredential", "DataVersionBase", "DataVersionBaseProperties", "DataVersionBaseResourceArmPaginatedResult", @@ -660,9 +982,15 @@ "DatastoreResourceArmPaginatedResult", "DatastoreSecrets", "DefaultScaleSettings", + "DeltaModelCurrentState", + "DeltaModelListRequest", + "DeltaModelModifyRequest", + "DeltaModelStatusRequest", + "DeltaModelStatusResponse", "DeploymentLogs", "DeploymentLogsRequest", "DeploymentResourceConfiguration", + "DestinationAsset", "DiagnoseRequestProperties", "DiagnoseResponseResult", "DiagnoseResponseResultValue", @@ -670,14 +998,32 @@ "DiagnoseWorkspaceParameters", "DistributionConfiguration", "Docker", + "DockerCredential", "EarlyTerminationPolicy", - "EncryptionKeyVaultProperties", + "EncryptionKeyVaultUpdateProperties", "EncryptionProperty", + "EncryptionUpdateProperties", "Endpoint", "EndpointAuthKeys", "EndpointAuthToken", + "EndpointDeploymentModel", "EndpointDeploymentPropertiesBase", + "EndpointDeploymentResourceProperties", + "EndpointDeploymentResourcePropertiesBasicResource", + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", + "EndpointKeys", + "EndpointModelDeprecationProperties", + "EndpointModelProperties", + "EndpointModelSkuCapacityProperties", + "EndpointModelSkuProperties", + "EndpointModelSkuRateLimitProperties", + "EndpointModelSkuRateLimitRulePatternProperties", + "EndpointModelSkuRateLimitRuleProperties", + "EndpointModels", "EndpointPropertiesBase", + "EndpointResourceProperties", + "EndpointResourcePropertiesBasicResource", + "EndpointResourcePropertiesBasicResourceArmPaginatedResult", "EndpointScheduleAction", "EnvironmentContainer", "EnvironmentContainerProperties", @@ -695,17 +1041,52 @@ "FQDNEndpoint", "FQDNEndpointDetail", "FQDNEndpoints", - "FQDNEndpointsProperties", + "FQDNEndpointsPropertyBag", + "Feature", + "FeatureAttributionDriftMonitoringSignal", + "FeatureAttributionMetricThreshold", + "FeatureImportanceSettings", + "FeatureProperties", + "FeatureResourceArmPaginatedResult", + "FeatureStoreSettings", + "FeatureSubset", + "FeatureWindow", + "FeaturesetContainer", + "FeaturesetContainerProperties", + "FeaturesetContainerResourceArmPaginatedResult", + "FeaturesetSpecification", + "FeaturesetVersion", + "FeaturesetVersionBackfillRequest", + "FeaturesetVersionBackfillResponse", + "FeaturesetVersionProperties", + "FeaturesetVersionResourceArmPaginatedResult", + "FeaturestoreEntityContainer", + "FeaturestoreEntityContainerProperties", + "FeaturestoreEntityContainerResourceArmPaginatedResult", + "FeaturestoreEntityVersion", + "FeaturestoreEntityVersionProperties", + "FeaturestoreEntityVersionResourceArmPaginatedResult", "FeaturizationSettings", + "FineTuningJob", + "FineTuningVertical", + "FixedInputData", "FlavorData", "ForecastHorizon", "Forecasting", "ForecastingSettings", "ForecastingTrainingSettings", + "FqdnOutboundRule", + "GetBlobReferenceForConsumptionDto", + "GetBlobReferenceSASRequestDto", + "GetBlobReferenceSASResponseDto", "GridSamplingAlgorithm", + "GroupEnvironmentConfiguration", + "GroupModelConfiguration", + "GroupStatus", "HDInsight", "HDInsightProperties", "HDInsightSchema", + "IPRule", "IdAssetReference", "IdentityConfiguration", "IdentityForCmk", @@ -727,7 +1108,17 @@ "ImageObjectDetectionBase", "ImageSweepSettings", "ImageVertical", + "IndexColumn", "InferenceContainerProperties", + "InferenceEndpoint", + "InferenceEndpointProperties", + "InferenceEndpointTrackedResourceArmPaginatedResult", + "InferenceGroup", + "InferenceGroupProperties", + "InferenceGroupTrackedResourceArmPaginatedResult", + "InferencePool", + "InferencePoolProperties", + "InferencePoolTrackedResourceArmPaginatedResult", "InstanceTypeSchema", "InstanceTypeSchemaResources", "JobBase", @@ -737,12 +1128,16 @@ "JobLimits", "JobOutput", "JobResourceConfiguration", + "JobResources", "JobScheduleAction", "JobService", + "JupyterKernelConfig", + "KeyVaultProperties", "Kubernetes", "KubernetesOnlineDeployment", "KubernetesProperties", "KubernetesSchema", + "LakeHouseArtifact", "ListAmlUserFeatureResult", "ListNotebookKeysResult", "ListStorageAccountKeysResult", @@ -755,19 +1150,47 @@ "MLTableData", "MLTableJobInput", "MLTableJobOutput", + "ManagedComputeIdentity", "ManagedIdentity", "ManagedIdentityAuthTypeWorkspaceConnectionProperties", + "ManagedIdentityCredential", + "ManagedNetworkProvisionOptions", + "ManagedNetworkProvisionStatus", + "ManagedNetworkSettings", "ManagedOnlineDeployment", + "ManagedOnlineEndpointDeploymentResourceProperties", + "ManagedOnlineEndpointResourceProperties", + "ManagedResourceGroupAssignedIdentities", + "ManagedResourceGroupSettings", "ManagedServiceIdentity", + "MarketplacePlan", + "MarketplaceSubscription", + "MarketplaceSubscriptionProperties", + "MarketplaceSubscriptionResourceArmPaginatedResult", + "MaterializationComputeResource", + "MaterializationSettings", "MedianStoppingPolicy", "ModelContainer", "ModelContainerProperties", "ModelContainerResourceArmPaginatedResult", + "ModelSettings", "ModelVersion", "ModelVersionProperties", "ModelVersionResourceArmPaginatedResult", + "MonitorComputeConfigurationBase", + "MonitorComputeIdentityBase", + "MonitorDefinition", + "MonitorEmailNotificationSettings", + "MonitorNotificationSettings", + "MonitorServerlessSparkCompute", + "MonitoringFeatureFilterBase", + "MonitoringInputDataBase", + "MonitoringSignalBase", + "MonitoringTarget", + "MonitoringThreshold", "Mpi", "NCrossValidations", + "NetworkAcls", "NlpVertical", "NlpVerticalFeaturizationSettings", "NlpVerticalLimitSettings", @@ -778,7 +1201,14 @@ "NotebookAccessTokenResult", "NotebookPreparationError", "NotebookResourceInfo", + "NotificationSetting", + "NumericalDataDriftMetricThreshold", + "NumericalDataQualityMetricThreshold", + "NumericalPredictionDriftMetricThreshold", + "OAuth2AuthTypeWorkspaceConnectionProperties", "Objective", + "OneLakeArtifact", + "OneLakeDatastore", "OnlineDeployment", "OnlineDeploymentProperties", "OnlineDeploymentTrackedResourceArmPaginatedResult", @@ -787,6 +1217,15 @@ "OnlineEndpointTrackedResourceArmPaginatedResult", "OnlineRequestSettings", "OnlineScaleSettings", + "OpenAIEndpointDeploymentResourceProperties", + "OpenAIEndpointResourceProperties", + "Operation", + "OperationDisplay", + "OperationListResult", + "OsPatchingStatus", + "OutboundRule", + "OutboundRuleBasicResource", + "OutboundRuleListResult", "OutputPathAssetReference", "PATAuthTypeWorkspaceConnectionProperties", "PaginatedComputeResourcesList", @@ -796,6 +1235,7 @@ "PartialMinimalTrackedResource", "PartialMinimalTrackedResourceWithIdentity", "PartialMinimalTrackedResourceWithSku", + "PartialMinimalTrackedResourceWithSkuAndIdentity", "PartialRegistryPartialTrackedResource", "PartialSku", "Password", @@ -804,22 +1244,42 @@ "PendingUploadResponseDto", "PersonalComputeInstanceSettings", "PipelineJob", + "PredictionDriftMetricThresholdBase", + "PredictionDriftMonitoringSignal", "PrivateEndpoint", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", + "PrivateEndpointDestination", + "PrivateEndpointOutboundRule", "PrivateEndpointResource", "PrivateLinkResource", "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", "ProbeSettings", + "PropertiesBase", + "ProxyResource", "PyTorch", + "QueueSettings", "QuotaBaseProperties", "QuotaUpdateParameters", + "RaiBlocklistConfig", + "RaiBlocklistItemBulkRequest", + "RaiBlocklistItemProperties", + "RaiBlocklistItemPropertiesBasicResource", + "RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult", + "RaiBlocklistProperties", + "RaiBlocklistPropertiesBasicResource", + "RaiBlocklistPropertiesBasicResourceArmPaginatedResult", + "RaiPolicyContentFilter", + "RaiPolicyProperties", + "RaiPolicyPropertiesBasicResource", + "RaiPolicyPropertiesBasicResourceArmPaginatedResult", "RandomSamplingAlgorithm", "Recurrence", "RecurrenceSchedule", "RecurrenceTrigger", "RegenerateEndpointKeysRequest", + "RegenerateServiceAccountKeyContent", "Registry", "RegistryListCredentialsResult", "RegistryPartialManagedServiceIdentity", @@ -829,20 +1289,26 @@ "RegistryTrackedResourceArmPaginatedResult", "Regression", "RegressionTrainingSettings", + "RequestConfiguration", + "RequestLogging", + "ResizeSchema", "Resource", "ResourceBase", "ResourceConfiguration", "ResourceId", "ResourceName", "ResourceQuota", + "RollingInputData", "Route", "SASAuthTypeWorkspaceConnectionProperties", + "SASCredential", "SASCredentialDto", "SamplingAlgorithm", "SasDatastoreCredentials", "SasDatastoreSecrets", "ScaleSettings", "ScaleSettingsInformation", + "ScaleUnitConfiguration", "Schedule", "ScheduleActionBase", "ScheduleBase", @@ -851,9 +1317,24 @@ "ScriptReference", "ScriptsToExecute", "Seasonality", + "SecretExpiry", + "ServerlessComputeSettings", + "ServerlessEndpoint", + "ServerlessEndpointCapacityReservation", + "ServerlessEndpointContentSafety", + "ServerlessEndpointInferenceEndpoint", + "ServerlessEndpointModelSettings", + "ServerlessEndpointProperties", + "ServerlessEndpointResourceProperties", + "ServerlessEndpointTrackedResourceArmPaginatedResult", + "ServerlessInferenceEndpoint", + "ServerlessOffer", "ServiceManagedResourcesSettings", + "ServicePrincipalAuthTypeWorkspaceConnectionProperties", "ServicePrincipalDatastoreCredentials", "ServicePrincipalDatastoreSecrets", + "ServiceTagDestination", + "ServiceTagOutboundRule", "SetupScripts", "SharedPrivateLinkResource", "Sku", @@ -861,9 +1342,19 @@ "SkuResource", "SkuResourceArmPaginatedResult", "SkuSetting", + "SparkJob", + "SparkJobEntry", + "SparkJobPythonEntry", + "SparkJobScalaEntry", + "SparkResourceConfiguration", + "SpeechEndpointDeploymentResourceProperties", + "SpeechEndpointResourceProperties", "SslConfiguration", "StackEnsembleSettings", + "StaticInputData", "StorageAccountDetails", + "StringArmPaginatedResult", + "StringKeyValuePair", "SweepJob", "SweepJobLimits", "SynapseSpark", @@ -883,6 +1374,7 @@ "TextClassificationMultilabel", "TextNer", "TmpfsOptions", + "TopNFeaturesByAttribution", "TrackedResource", "TrainingSettings", "TrialComponent", @@ -917,26 +1409,44 @@ "VirtualMachineSshCredentials", "VolumeDefinition", "VolumeOptions", + "Webhook", "Workspace", + "WorkspaceConnectionAccessKey", + "WorkspaceConnectionAccountKey", + "WorkspaceConnectionApiKey", "WorkspaceConnectionManagedIdentity", + "WorkspaceConnectionOAuth2", "WorkspaceConnectionPersonalAccessToken", "WorkspaceConnectionPropertiesV2", "WorkspaceConnectionPropertiesV2BasicResource", "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", + "WorkspaceConnectionServicePrincipal", "WorkspaceConnectionSharedAccessSignature", + "WorkspaceConnectionUpdateParameter", "WorkspaceConnectionUsernamePassword", + "WorkspaceHubConfig", "WorkspaceListResult", + "WorkspacePrivateEndpointResource", "WorkspaceUpdateParameters", + "ActionType", "AllocationState", + "AllowedContentLevel", "ApplicationSharingPolicy", "AssetProvisioningState", + "AuthMode", "AutoRebuildSetting", "Autosave", + "BatchDeploymentConfigurationType", "BatchLoggingLevel", "BatchOutputAction", "BillingCurrency", "BlockedTransformers", "Caching", + "CapabilityHostKind", + "CapabilityHostProvisioningState", + "CategoricalDataDriftMetric", + "CategoricalDataQualityMetric", + "CategoricalPredictionDriftMetric", "ClassificationModels", "ClassificationMultilabelPrimaryMetrics", "ClassificationPrimaryMetrics", @@ -944,28 +1454,46 @@ "ComputeInstanceAuthorizationType", "ComputeInstanceState", "ComputePowerAction", + "ComputeRecurrenceFrequency", + "ComputeTriggerType", "ComputeType", + "ComputeWeekDay", "ConnectionAuthType", "ConnectionCategory", + "ConnectionGroup", "ContainerType", + "ContentSafetyStatus", "CreatedByType", "CredentialsType", + "DataAvailabilityStatus", + "DataCollectionMode", + "DataReferenceCredentialType", "DataType", "DatastoreType", + "DefaultActionType", + "DefaultResourceProvisioningState", + "DeploymentModelVersionUpgradeOption", "DeploymentProvisioningState", "DiagnoseResultLevel", "DistributionType", "EarlyTerminationPolicyType", "EgressPublicNetworkAccessType", + "EmailNotificationEnableType", "EncryptionStatus", "EndpointAuthMode", "EndpointComputeType", "EndpointProvisioningState", "EndpointServiceConnectionStatus", + "EndpointType", "EnvironmentType", "EnvironmentVariableType", + "FeatureAttributionMetric", + "FeatureDataType", + "FeatureImportanceMode", "FeatureLags", "FeaturizationMode", + "FineTuningTaskType", + "FirewallSku", "ForecastHorizonMode", "ForecastingModels", "ForecastingPrimaryMetrics", @@ -974,48 +1502,81 @@ "ImageType", "InputDeliveryMode", "InstanceSegmentationPrimaryMetrics", + "IsolationMode", "JobInputType", "JobLimitsType", "JobOutputType", "JobStatus", + "JobTier", "JobType", "KeyType", "LearningRateScheduler", "ListViewType", "LoadBalancerType", "LogVerbosity", + "ManagedNetworkStatus", + "ManagedPERequirement", + "ManagedPEStatus", "ManagedServiceIdentityType", + "MarketplaceSubscriptionProvisioningState", + "MarketplaceSubscriptionStatus", + "MaterializationStoreType", + "MlflowAutologger", + "ModelLifecycleStatus", + "ModelProvider", "ModelSize", + "ModelTaskType", + "MonitorComputeIdentityType", + "MonitorComputeType", + "MonitoringFeatureDataType", + "MonitoringFeatureFilterType", + "MonitoringInputDataType", + "MonitoringNotificationType", + "MonitoringSignalType", "MountAction", + "MountMode", "MountState", "NCrossValidationsMode", "Network", "NodeState", "NodesValueType", + "NumericalDataDriftMetric", + "NumericalDataQualityMetric", + "NumericalPredictionDriftMetric", "ObjectDetectionPrimaryMetrics", + "OneLakeArtifactType", "OperatingSystemType", "OperationName", "OperationStatus", "OperationTrigger", "OrderString", + "Origin", "OsType", "OutputDeliveryMode", + "PatchStatus", "PendingUploadCredentialType", "PendingUploadType", + "PoolProvisioningState", "PrivateEndpointConnectionProvisioningState", - "PrivateEndpointServiceConnectionStatus", "Protocol", "ProvisioningState", "ProvisioningStatus", - "PublicNetworkAccess", "PublicNetworkAccessType", "QuotaUnit", + "RaiPolicyContentSource", + "RaiPolicyMode", + "RaiPolicyType", "RandomSamplingAlgorithmRule", "RecurrenceFrequency", "ReferenceType", "RegressionModels", "RegressionPrimaryMetrics", "RemoteLoginPortPublicAccess", + "RollingRateType", + "RuleAction", + "RuleCategory", + "RuleStatus", + "RuleType", "SamplingAlgorithmType", "ScaleType", "ScheduleActionType", @@ -1025,17 +1586,22 @@ "ScheduleStatus", "SeasonalityMode", "SecretsType", + "ServerlessEndpointState", + "ServerlessInferenceEndpointAuthMode", + "ServiceAccountKeyName", "ServiceDataAccessAuthIdentity", "ShortSeriesHandlingConfiguration", "SkuScaleType", "SkuTier", "SourceType", + "SparkJobEntryType", "SshPublicAccess", "SslConfigStatus", "StackMetaLearnerType", "Status", "StochasticOptimizer", "StorageAccountType", + "SystemDatastoresAuthMode", "TargetAggregationFunction", "TargetLagsMode", "TargetRollingWindowSizeMode", @@ -1048,9 +1614,9 @@ "VMPriceOSType", "VMTier", "ValidationMetricType", - "ValueFormat", "VmPriority", "VolumeDefinitionType", + "WebhookType", "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 a32b5b39144..bf111a8db5f 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 @@ -10,6 +10,12 @@ from azure.core import CaseInsensitiveEnumMeta +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + + INTERNAL = "Internal" + + class AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Allocation state of the compute. Possible values are: steady - Indicates that the compute is not resizing. There are no changes to the number of compute nodes in the compute in progress. A @@ -22,6 +28,14 @@ class AllocationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): RESIZING = "Resizing" +class AllowedContentLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Level at which content is filtered.""" + + LOW = "Low" + MEDIUM = "Medium" + HIGH = "High" + + class ApplicationSharingPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any @@ -43,6 +57,12 @@ class AssetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" +class AuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine endpoint authentication mode.""" + + AAD = "AAD" + + class AutoRebuildSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AutoRebuild setting for the derived image.""" @@ -58,6 +78,13 @@ class Autosave(str, Enum, metaclass=CaseInsensitiveEnumMeta): REMOTE = "Remote" +class BatchDeploymentConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The enumerated property types for batch deployments.""" + + MODEL = "Model" + PIPELINE_COMPONENT = "PipelineComponent" + + class BatchLoggingLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Log verbosity for batch inferencing. Increasing verbosity order for logging is : Warning, Info and Debug. @@ -93,22 +120,22 @@ class BlockedTransformers(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Target encoding for categorical data.""" TF_IDF = "TfIdf" """Tf-Idf stands for, term-frequency times inverse document-frequency. This is a common term - #: weighting scheme for identifying information from documents.""" + weighting scheme for identifying information from documents.""" WO_E_TARGET_ENCODER = "WoETargetEncoder" """Weight of Evidence encoding is a technique used to encode categorical variables. It uses the - #: natural log of the P(1)/P(0) to create weights.""" + natural log of the P(1)/P(0) to create weights.""" LABEL_ENCODER = "LabelEncoder" """Label encoder converts labels/categorical variables in a numerical form.""" WORD_EMBEDDING = "WordEmbedding" """Word embedding helps represents words or phrases as a vector, or a series of numbers.""" NAIVE_BAYES = "NaiveBayes" """Naive Bayes is a classified that is used for classification of discrete features that are - #: categorically distributed.""" + categorically distributed.""" COUNT_VECTORIZER = "CountVectorizer" """Count Vectorizer converts a collection of text documents to a matrix of token counts.""" HASH_ONE_HOT_ENCODER = "HashOneHotEncoder" """Hashing One Hot Encoder can turn categorical variables into a limited number of new features. - #: This is often used for high-cardinality categorical features.""" + This is often used for high-cardinality categorical features.""" class Caching(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -119,68 +146,118 @@ class Caching(str, Enum, metaclass=CaseInsensitiveEnumMeta): READ_WRITE = "ReadWrite" +class CapabilityHostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CapabilityHostKind.""" + + AGENTS = "Agents" + + +class CapabilityHostProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of capability host.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + +class CategoricalDataDriftMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoricalDataDriftMetric.""" + + JENSEN_SHANNON_DISTANCE = "JensenShannonDistance" + """The Jensen Shannon Distance (JSD) metric.""" + POPULATION_STABILITY_INDEX = "PopulationStabilityIndex" + """The Population Stability Index (PSI) metric.""" + PEARSONS_CHI_SQUARED_TEST = "PearsonsChiSquaredTest" + """The Pearsons Chi Squared Test metric.""" + + +class CategoricalDataQualityMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoricalDataQualityMetric.""" + + NULL_VALUE_RATE = "NullValueRate" + """Calculates the rate of null values.""" + DATA_TYPE_ERROR_RATE = "DataTypeErrorRate" + """Calculates the rate of data type errors.""" + OUT_OF_BOUNDS_RATE = "OutOfBoundsRate" + """Calculates the rate values are out of bounds.""" + + +class CategoricalPredictionDriftMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CategoricalPredictionDriftMetric.""" + + JENSEN_SHANNON_DISTANCE = "JensenShannonDistance" + """The Jensen Shannon Distance (JSD) metric.""" + POPULATION_STABILITY_INDEX = "PopulationStabilityIndex" + """The Population Stability Index (PSI) metric.""" + PEARSONS_CHI_SQUARED_TEST = "PearsonsChiSquaredTest" + """The Pearsons Chi Squared Test metric.""" + + class ClassificationModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum for all classification models supported by AutoML.""" LOGISTIC_REGRESSION = "LogisticRegression" """Logistic regression is a fundamental classification technique. - #: It belongs to the group of linear classifiers and is somewhat similar to polynomial and linear - #: regression. - #: Logistic regression is fast and relatively uncomplicated, and it's convenient for you to - #: interpret the results. - #: Although it's essentially a method for binary classification, it can also be applied to - #: multiclass problems.""" + It belongs to the group of linear classifiers and is somewhat similar to polynomial and linear + regression. + Logistic regression is fast and relatively uncomplicated, and it's convenient for you to + interpret the results. + Although it's essentially a method for binary classification, it can also be applied to + multiclass problems.""" SGD = "SGD" """SGD: Stochastic gradient descent is an optimization algorithm often used in machine learning - #: applications - #: to find the model parameters that correspond to the best fit between predicted and actual - #: outputs.""" + applications + to find the model parameters that correspond to the best fit between predicted and actual + outputs.""" MULTINOMIAL_NAIVE_BAYES = "MultinomialNaiveBayes" """The multinomial Naive Bayes classifier is suitable for classification with discrete features - #: (e.g., word counts for text classification). - #: The multinomial distribution normally requires integer feature counts. However, in practice, - #: fractional counts such as tf-idf may also work.""" + (e.g., word counts for text classification). + The multinomial distribution normally requires integer feature counts. However, in practice, + fractional counts such as tf-idf may also work.""" BERNOULLI_NAIVE_BAYES = "BernoulliNaiveBayes" """Naive Bayes classifier for multivariate Bernoulli models.""" SVM = "SVM" """A support vector machine (SVM) is a supervised machine learning model that uses classification - #: algorithms for two-group classification problems. - #: After giving an SVM model sets of labeled training data for each category, they're able to - #: categorize new text.""" + algorithms for two-group classification problems. + After giving an SVM model sets of labeled training data for each category, they're able to + categorize new text.""" LINEAR_SVM = "LinearSVM" """A support vector machine (SVM) is a supervised machine learning model that uses classification - #: algorithms for two-group classification problems. - #: After giving an SVM model sets of labeled training data for each category, they're able to - #: categorize new text. - #: Linear SVM performs best when input data is linear, i.e., data can be easily classified by - #: drawing the straight line between classified values on a plotted graph.""" + algorithms for two-group classification problems. + After giving an SVM model sets of labeled training data for each category, they're able to + categorize new text. + Linear SVM performs best when input data is linear, i.e., data can be easily classified by + drawing the straight line between classified values on a plotted graph.""" KNN = "KNN" """K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values of new - #: datapoints - #: which further means that the new data point will be assigned a value based on how closely it - #: matches the points in the training set.""" + datapoints + which further means that the new data point will be assigned a value based on how closely it + matches the points in the training set.""" DECISION_TREE = "DecisionTree" """Decision Trees are a non-parametric supervised learning method used for both classification and - #: regression tasks. - #: The goal is to create a model that predicts the value of a target variable by learning simple - #: decision rules inferred from the data features.""" + regression tasks. + The goal is to create a model that predicts the value of a target variable by learning simple + decision rules inferred from the data features.""" RANDOM_FOREST = "RandomForest" """Random forest is a supervised learning algorithm. - #: The "forest"\ it builds, is an ensemble of decision trees, usually trained with the “bagging”\ - #: method. - #: The general idea of the bagging method is that a combination of learning models increases the - #: overall result.""" + The "forest" it builds, is an ensemble of decision trees, usually trained with the "bagging" + method. + The general idea of the bagging method is that a combination of learning models increases the + overall result.""" EXTREME_RANDOM_TREES = "ExtremeRandomTrees" """Extreme Trees is an ensemble machine learning algorithm that combines the predictions from many - #: decision trees. It is related to the widely used random forest algorithm.""" + decision trees. It is related to the widely used random forest algorithm.""" LIGHT_GBM = "LightGBM" """LightGBM is a gradient boosting framework that uses tree based learning algorithms.""" GRADIENT_BOOSTING = "GradientBoosting" """The technique of transiting week learners into a strong learner is called Boosting. The - #: gradient boosting algorithm process works on this theory of execution.""" + gradient boosting algorithm process works on this theory of execution.""" XG_BOOST_CLASSIFIER = "XGBoostClassifier" """XGBoost: Extreme Gradient Boosting Algorithm. This algorithm is used for structured data where - #: target column values can be divided into distinct class values.""" + target column values can be divided into distinct class values.""" class ClassificationMultilabelPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -188,19 +265,19 @@ class ClassificationMultilabelPrimaryMetrics(str, Enum, metaclass=CaseInsensitiv AUC_WEIGHTED = "AUCWeighted" """AUC is the Area under the curve. - #: This metric represents arithmetic mean of the score for each class, - #: weighted by the number of true instances in each class.""" + This metric represents arithmetic mean of the score for each class, + weighted by the number of true instances in each class.""" ACCURACY = "Accuracy" """Accuracy is the ratio of predictions that exactly match the true class labels.""" NORM_MACRO_RECALL = "NormMacroRecall" """Normalized macro recall is recall macro-averaged and normalized, so that random - #: performance has a score of 0, and perfect performance has a score of 1.""" + performance has a score of 0, and perfect performance has a score of 1.""" AVERAGE_PRECISION_SCORE_WEIGHTED = "AveragePrecisionScoreWeighted" """The arithmetic mean of the average precision score for each class, weighted by - #: the number of true instances in each class.""" + the number of true instances in each class.""" PRECISION_SCORE_WEIGHTED = "PrecisionScoreWeighted" """The arithmetic mean of precision for each class, weighted by number of true instances in each - #: class.""" + class.""" IOU = "IOU" """Intersection Over Union. Intersection of predictions divided by union of predictions.""" @@ -210,19 +287,19 @@ class ClassificationPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta) AUC_WEIGHTED = "AUCWeighted" """AUC is the Area under the curve. - #: This metric represents arithmetic mean of the score for each class, - #: weighted by the number of true instances in each class.""" + This metric represents arithmetic mean of the score for each class, + weighted by the number of true instances in each class.""" ACCURACY = "Accuracy" """Accuracy is the ratio of predictions that exactly match the true class labels.""" NORM_MACRO_RECALL = "NormMacroRecall" """Normalized macro recall is recall macro-averaged and normalized, so that random - #: performance has a score of 0, and perfect performance has a score of 1.""" + performance has a score of 0, and perfect performance has a score of 1.""" AVERAGE_PRECISION_SCORE_WEIGHTED = "AveragePrecisionScoreWeighted" """The arithmetic mean of the average precision score for each class, weighted by - #: the number of true instances in each class.""" + the number of true instances in each class.""" PRECISION_SCORE_WEIGHTED = "PrecisionScoreWeighted" """The arithmetic mean of precision for each class, weighted by number of true instances in each - #: class.""" + class.""" class ClusterPurpose(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -247,6 +324,7 @@ class ComputeInstanceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): DELETING = "Deleting" RUNNING = "Running" RESTARTING = "Restarting" + RESIZING = "Resizing" JOB_RUNNING = "JobRunning" SETTING_UP = "SettingUp" SETUP_FAILED = "SetupFailed" @@ -260,12 +338,34 @@ 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" +class ComputeRecurrenceFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to describe the frequency of a compute recurrence schedule.""" + + MINUTE = "Minute" + """Minute frequency""" + HOUR = "Hour" + """Hour frequency""" + DAY = "Day" + """Day frequency""" + WEEK = "Week" + """Week frequency""" + MONTH = "Month" + """Month frequency""" + + +class ComputeTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ComputeTriggerType.""" + + RECURRENCE = "Recurrence" + CRON = "Cron" + + class ComputeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of compute.""" @@ -281,6 +381,25 @@ class ComputeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYNAPSE_SPARK = "SynapseSpark" +class ComputeWeekDay(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum of weekday.""" + + MONDAY = "Monday" + """Monday weekday""" + TUESDAY = "Tuesday" + """Tuesday weekday""" + WEDNESDAY = "Wednesday" + """Wednesday weekday""" + THURSDAY = "Thursday" + """Thursday weekday""" + FRIDAY = "Friday" + """Friday weekday""" + SATURDAY = "Saturday" + """Saturday weekday""" + SUNDAY = "Sunday" + """Sunday weekday""" + + class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Authentication type of the connection target.""" @@ -289,6 +408,13 @@ class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USERNAME_PASSWORD = "UsernamePassword" NONE = "None" SAS = "SAS" + ACCOUNT_KEY = "AccountKey" + SERVICE_PRINCIPAL = "ServicePrincipal" + ACCESS_KEY = "AccessKey" + API_KEY = "ApiKey" + CUSTOM_KEYS = "CustomKeys" + O_AUTH2 = "OAuth2" + AAD = "AAD" class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -297,6 +423,120 @@ class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): PYTHON_FEED = "PythonFeed" CONTAINER_REGISTRY = "ContainerRegistry" GIT = "Git" + S3 = "S3" + SNOWFLAKE = "Snowflake" + AZURE_SQL_DB = "AzureSqlDb" + AZURE_SYNAPSE_ANALYTICS = "AzureSynapseAnalytics" + AZURE_MY_SQL_DB = "AzureMySqlDb" + AZURE_POSTGRES_DB = "AzurePostgresDb" + ADLS_GEN2 = "ADLSGen2" + REDIS = "Redis" + API_KEY = "ApiKey" + AZURE_OPEN_AI = "AzureOpenAI" + AI_SERVICES = "AIServices" + COGNITIVE_SEARCH = "CognitiveSearch" + COGNITIVE_SERVICE = "CognitiveService" + CUSTOM_KEYS = "CustomKeys" + AZURE_BLOB = "AzureBlob" + AZURE_ONE_LAKE = "AzureOneLake" + COSMOS_DB = "CosmosDb" + COSMOS_DB_MONGO_DB_API = "CosmosDbMongoDbApi" + AZURE_DATA_EXPLORER = "AzureDataExplorer" + AZURE_MARIA_DB = "AzureMariaDb" + AZURE_DATABRICKS_DELTA_LAKE = "AzureDatabricksDeltaLake" + AZURE_SQL_MI = "AzureSqlMi" + AZURE_TABLE_STORAGE = "AzureTableStorage" + AMAZON_RDS_FOR_ORACLE = "AmazonRdsForOracle" + AMAZON_RDS_FOR_SQL_SERVER = "AmazonRdsForSqlServer" + AMAZON_REDSHIFT = "AmazonRedshift" + DB2 = "Db2" + DRILL = "Drill" + GOOGLE_BIG_QUERY = "GoogleBigQuery" + GREENPLUM = "Greenplum" + HBASE = "Hbase" + HIVE = "Hive" + IMPALA = "Impala" + INFORMIX = "Informix" + MARIA_DB = "MariaDb" + MICROSOFT_ACCESS = "MicrosoftAccess" + MY_SQL = "MySql" + NETEZZA = "Netezza" + ORACLE = "Oracle" + PHOENIX = "Phoenix" + POSTGRE_SQL = "PostgreSql" + PRESTO = "Presto" + SAP_OPEN_HUB = "SapOpenHub" + SAP_BW = "SapBw" + SAP_HANA = "SapHana" + SAP_TABLE = "SapTable" + SPARK = "Spark" + SQL_SERVER = "SqlServer" + SYBASE = "Sybase" + TERADATA = "Teradata" + VERTICA = "Vertica" + PINECONE = "Pinecone" + CASSANDRA = "Cassandra" + COUCHBASE = "Couchbase" + MONGO_DB_V2 = "MongoDbV2" + MONGO_DB_ATLAS = "MongoDbAtlas" + AMAZON_S3_COMPATIBLE = "AmazonS3Compatible" + FILE_SERVER = "FileServer" + FTP_SERVER = "FtpServer" + GOOGLE_CLOUD_STORAGE = "GoogleCloudStorage" + HDFS = "Hdfs" + ORACLE_CLOUD_STORAGE = "OracleCloudStorage" + SFTP = "Sftp" + GENERIC_HTTP = "GenericHttp" + O_DATA_REST = "ODataRest" + ODBC = "Odbc" + GENERIC_REST = "GenericRest" + AMAZON_MWS = "AmazonMws" + CONCUR = "Concur" + DYNAMICS = "Dynamics" + DYNAMICS_AX = "DynamicsAx" + DYNAMICS_CRM = "DynamicsCrm" + GOOGLE_AD_WORDS = "GoogleAdWords" + HUBSPOT = "Hubspot" + JIRA = "Jira" + MAGENTO = "Magento" + MARKETO = "Marketo" + OFFICE365 = "Office365" + ELOQUA = "Eloqua" + RESPONSYS = "Responsys" + ORACLE_SERVICE_CLOUD = "OracleServiceCloud" + PAY_PAL = "PayPal" + QUICK_BOOKS = "QuickBooks" + SALESFORCE = "Salesforce" + SALESFORCE_SERVICE_CLOUD = "SalesforceServiceCloud" + SALESFORCE_MARKETING_CLOUD = "SalesforceMarketingCloud" + SAP_CLOUD_FOR_CUSTOMER = "SapCloudForCustomer" + SAP_ECC = "SapEcc" + SERVICE_NOW = "ServiceNow" + SHARE_POINT_ONLINE_LIST = "SharePointOnlineList" + SHOPIFY = "Shopify" + SQUARE = "Square" + WEB_TABLE = "WebTable" + XERO = "Xero" + ZOHO = "Zoho" + GENERIC_CONTAINER_REGISTRY = "GenericContainerRegistry" + ELASTICSEARCH = "Elasticsearch" + OPEN_AI = "OpenAI" + SERP = "Serp" + BING_LLM_SEARCH = "BingLLMSearch" + SERVERLESS = "Serverless" + MANAGED_ONLINE_ENDPOINT = "ManagedOnlineEndpoint" + + +class ConnectionGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Group based on connection category.""" + + AZURE = "Azure" + AZURE_AI = "AzureAI" + DATABASE = "Database" + NO_SQL = "NoSQL" + FILE = "File" + GENERIC_PROTOCOL = "GenericProtocol" + SERVICES_AND_APPS = "ServicesAndApps" class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -306,6 +546,13 @@ class ContainerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): INFERENCE_SERVER = "InferenceServer" +class ContentSafetyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the status of content safety.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource.""" @@ -325,6 +572,31 @@ class CredentialsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL = "ServicePrincipal" +class DataAvailabilityStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataAvailabilityStatus.""" + + NONE = "None" + PENDING = "Pending" + INCOMPLETE = "Incomplete" + COMPLETE = "Complete" + + +class DataCollectionMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DataCollectionMode.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class DataReferenceCredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the DataReference credentials type.""" + + SAS = "SAS" + DOCKER_CREDENTIALS = "DockerCredentials" + MANAGED_IDENTITY = "ManagedIdentity" + NO_CREDENTIALS = "NoCredentials" + + class DatastoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine the datastore contents type.""" @@ -332,6 +604,7 @@ class DatastoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_DATA_LAKE_GEN1 = "AzureDataLakeGen1" AZURE_DATA_LAKE_GEN2 = "AzureDataLakeGen2" AZURE_FILE = "AzureFile" + ONE_LAKE = "OneLake" class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -342,6 +615,36 @@ class DataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MLTABLE = "mltable" +class DefaultActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DefaultActionType.""" + + DENY = "Deny" + ALLOW = "Allow" + + +class DefaultResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """DefaultResourceProvisioningState.""" + + NOT_STARTED = "NotStarted" + FAILED = "Failed" + CREATING = "Creating" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + ACCEPTED = "Accepted" + CANCELED = "Canceled" + SCALING = "Scaling" + DISABLED = "Disabled" + + +class DeploymentModelVersionUpgradeOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Deployment model version upgrade option.""" + + ONCE_NEW_DEFAULT_VERSION_AVAILABLE = "OnceNewDefaultVersionAvailable" + ONCE_CURRENT_VERSION_EXPIRED = "OnceCurrentVersionExpired" + NO_AUTO_UPGRADE = "NoAutoUpgrade" + + class DeploymentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Possible values for DeploymentProvisioningState.""" @@ -387,6 +690,14 @@ class EgressPublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta DISABLED = "Disabled" +class EmailNotificationEnableType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the email notification type.""" + + JOB_COMPLETED = "JobCompleted" + JOB_FAILED = "JobFailed" + JOB_CANCELLED = "JobCancelled" + + class EncryptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether or not the encryption is enabled for the workspace.""" @@ -428,6 +739,18 @@ class EndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMe PENDING = "Pending" REJECTED = "Rejected" DISCONNECTED = "Disconnected" + TIMEOUT = "Timeout" + + +class EndpointType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of the endpoint.""" + + AZURE_OPEN_AI = "Azure.OpenAI" + AZURE_SPEECH = "Azure.Speech" + AZURE_CONTENT_SAFETY = "Azure.ContentSafety" + AZURE_LLAMA = "Azure.Llama" + MANAGED_ONLINE_ENDPOINT = "managedOnlineEndpoint" + SERVERLESS_ENDPOINT = "serverlessEndpoint" class EnvironmentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -443,6 +766,35 @@ class EnvironmentVariableType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LOCAL = "local" +class FeatureAttributionMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FeatureAttributionMetric.""" + + NORMALIZED_DISCOUNTED_CUMULATIVE_GAIN = "NormalizedDiscountedCumulativeGain" + """The Normalized Discounted Cumulative Gain metric.""" + + +class FeatureDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FeatureDataType.""" + + STRING = "String" + INTEGER = "Integer" + LONG = "Long" + FLOAT = "Float" + DOUBLE = "Double" + BINARY = "Binary" + DATETIME = "Datetime" + BOOLEAN = "Boolean" + + +class FeatureImportanceMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode of operation for computing feature importance.""" + + DISABLED = "Disabled" + """Disables computing feature importance within a signal.""" + ENABLED = "Enabled" + """Enables computing feature importance within a signal.""" + + class FeatureLags(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Flag for generating lags for the numeric features.""" @@ -463,6 +815,29 @@ class FeaturizationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Featurization off. 'Forecasting' task cannot use this value.""" +class FineTuningTaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """FineTuningTaskType.""" + + CHAT_COMPLETION = "ChatCompletion" + TEXT_COMPLETION = "TextCompletion" + TEXT_CLASSIFICATION = "TextClassification" + QUESTION_ANSWERING = "QuestionAnswering" + TEXT_SUMMARIZATION = "TextSummarization" + TOKEN_CLASSIFICATION = "TokenClassification" + TEXT_TRANSLATION = "TextTranslation" + IMAGE_CLASSIFICATION = "ImageClassification" + IMAGE_INSTANCE_SEGMENTATION = "ImageInstanceSegmentation" + IMAGE_OBJECT_DETECTION = "ImageObjectDetection" + VIDEO_MULTI_OBJECT_TRACKING = "VideoMultiObjectTracking" + + +class FirewallSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Firewall Sku used for FQDN Rules.""" + + STANDARD = "Standard" + BASIC = "Basic" + + class ForecastHorizonMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine forecast horizon selection mode.""" @@ -477,78 +852,78 @@ class ForecastingModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO_ARIMA = "AutoArima" """Auto-Autoregressive Integrated Moving Average (ARIMA) model uses time-series data and - #: statistical analysis to interpret the data and make future predictions. - #: This model aims to explain data by using time series data on its past values and uses linear - #: regression to make predictions.""" + statistical analysis to interpret the data and make future predictions. + This model aims to explain data by using time series data on its past values and uses linear + regression to make predictions.""" PROPHET = "Prophet" """Prophet is a procedure for forecasting time series data based on an additive model where - #: non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. - #: It works best with time series that have strong seasonal effects and several seasons of - #: historical data. Prophet is robust to missing data and shifts in the trend, and typically - #: handles outliers well.""" + non-linear trends are fit with yearly, weekly, and daily seasonality, plus holiday effects. + It works best with time series that have strong seasonal effects and several seasons of + historical data. Prophet is robust to missing data and shifts in the trend, and typically + handles outliers well.""" NAIVE = "Naive" """The Naive forecasting model makes predictions by carrying forward the latest target value for - #: each time-series in the training data.""" + each time-series in the training data.""" SEASONAL_NAIVE = "SeasonalNaive" """The Seasonal Naive forecasting model makes predictions by carrying forward the latest season of - #: target values for each time-series in the training data.""" + target values for each time-series in the training data.""" AVERAGE = "Average" """The Average forecasting model makes predictions by carrying forward the average of the target - #: values for each time-series in the training data.""" + values for each time-series in the training data.""" SEASONAL_AVERAGE = "SeasonalAverage" """The Seasonal Average forecasting model makes predictions by carrying forward the average value - #: of the latest season of data for each time-series in the training data.""" + of the latest season of data for each time-series in the training data.""" EXPONENTIAL_SMOOTHING = "ExponentialSmoothing" """Exponential smoothing is a time series forecasting method for univariate data that can be - #: extended to support data with a systematic trend or seasonal component.""" + extended to support data with a systematic trend or seasonal component.""" ARIMAX = "Arimax" """An Autoregressive Integrated Moving Average with Explanatory Variable (ARIMAX) model can be - #: viewed as a multiple regression model with one or more autoregressive (AR) terms and/or one or - #: more moving average (MA) terms. - #: This method is suitable for forecasting when data is stationary/non stationary, and - #: multivariate with any type of data pattern, i.e., level/trend /seasonality/cyclicity.""" + viewed as a multiple regression model with one or more autoregressive (AR) terms and/or one or + more moving average (MA) terms. + This method is suitable for forecasting when data is stationary/non stationary, and + multivariate with any type of data pattern, i.e., level/trend /seasonality/cyclicity.""" TCN_FORECASTER = "TCNForecaster" """TCNForecaster: Temporal Convolutional Networks Forecaster. //TODO: Ask forecasting team for - #: brief intro.""" + brief intro.""" ELASTIC_NET = "ElasticNet" """Elastic net is a popular type of regularized linear regression that combines two popular - #: penalties, specifically the L1 and L2 penalty functions.""" + penalties, specifically the L1 and L2 penalty functions.""" GRADIENT_BOOSTING = "GradientBoosting" """The technique of transiting week learners into a strong learner is called Boosting. The - #: gradient boosting algorithm process works on this theory of execution.""" + gradient boosting algorithm process works on this theory of execution.""" DECISION_TREE = "DecisionTree" """Decision Trees are a non-parametric supervised learning method used for both classification and - #: regression tasks. - #: The goal is to create a model that predicts the value of a target variable by learning simple - #: decision rules inferred from the data features.""" + regression tasks. + The goal is to create a model that predicts the value of a target variable by learning simple + decision rules inferred from the data features.""" KNN = "KNN" """K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values of new - #: datapoints - #: which further means that the new data point will be assigned a value based on how closely it - #: matches the points in the training set.""" + datapoints + which further means that the new data point will be assigned a value based on how closely it + matches the points in the training set.""" LASSO_LARS = "LassoLars" """Lasso model fit with Least Angle Regression a.k.a. Lars. It is a Linear Model trained with an - #: L1 prior as regularizer.""" + L1 prior as regularizer.""" SGD = "SGD" """SGD: Stochastic gradient descent is an optimization algorithm often used in machine learning - #: applications - #: to find the model parameters that correspond to the best fit between predicted and actual - #: outputs. - #: It's an inexact but powerful technique.""" + applications + to find the model parameters that correspond to the best fit between predicted and actual + outputs. + It's an inexact but powerful technique.""" RANDOM_FOREST = "RandomForest" """Random forest is a supervised learning algorithm. - #: The "forest" it builds, is an ensemble of decision trees, usually trained with the “bagging” - #: method. - #: The general idea of the bagging method is that a combination of learning models increases the - #: overall result.""" + The "forest" it builds, is an ensemble of decision trees, usually trained with the "bagging" + method. + The general idea of the bagging method is that a combination of learning models increases the + overall result.""" EXTREME_RANDOM_TREES = "ExtremeRandomTrees" """Extreme Trees is an ensemble machine learning algorithm that combines the predictions from many - #: decision trees. It is related to the widely used random forest algorithm.""" + decision trees. It is related to the widely used random forest algorithm.""" LIGHT_GBM = "LightGBM" """LightGBM is a gradient boosting framework that uses tree based learning algorithms.""" XG_BOOST_REGRESSOR = "XGBoostRegressor" """XGBoostRegressor: Extreme Gradient Boosting Regressor is a supervised machine learning model - #: using ensemble of base learners.""" + using ensemble of base learners.""" class ForecastingPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -558,13 +933,13 @@ class ForecastingPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Spearman's rank coefficient of correlation is a non-parametric measure of rank correlation.""" NORMALIZED_ROOT_MEAN_SQUARED_ERROR = "NormalizedRootMeanSquaredError" """The Normalized Root Mean Squared Error (NRMSE) the RMSE facilitates the comparison between - #: models with different scales.""" + models with different scales.""" R2_SCORE = "R2Score" """The R2 score is one of the performance evaluation measures for forecasting-based machine - #: learning models.""" + learning models.""" NORMALIZED_MEAN_ABSOLUTE_ERROR = "NormalizedMeanAbsoluteError" """The Normalized Mean Absolute Error (NMAE) is a validation metric to compare the Mean Absolute - #: Error (MAE) of (time) series with different scales.""" + Error (MAE) of (time) series with different scales.""" class Goal(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -584,7 +959,7 @@ class IdentityConfigurationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ImageType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of the image. Possible values are: docker - For docker images. azureml - For AzureML - images. + Environment images (custom and curated). """ DOCKER = "docker" @@ -607,7 +982,15 @@ class InstanceSegmentationPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnu MEAN_AVERAGE_PRECISION = "MeanAveragePrecision" """Mean Average Precision (MAP) is the average of AP (Average Precision). - #: AP is calculated for each class and averaged to get the MAP.""" + AP is calculated for each class and averaged to get the MAP.""" + + +class IsolationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Isolation mode for the managed network of a machine learning workspace.""" + + DISABLED = "Disabled" + ALLOW_INTERNET_OUTBOUND = "AllowInternetOutbound" + ALLOW_ONLY_APPROVED_OUTBOUND = "AllowOnlyApprovedOutbound" class JobInputType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -653,7 +1036,7 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The run environment is being prepared.""" QUEUED = "Queued" """The job is queued in the compute target. For example, in BatchAI the job is in queued state, - #: while waiting for all required nodes to be ready.""" + while waiting for all required nodes to be ready.""" RUNNING = "Running" """The job started to run in the compute target.""" FINALIZING = "Finalizing" @@ -662,22 +1045,32 @@ class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Cancellation has been requested for the job.""" COMPLETED = "Completed" """Job completed successfully. This reflects that both the job itself and output collection states - #: completed successfully""" + completed successfully""" FAILED = "Failed" """Job failed.""" CANCELED = "Canceled" """Following cancellation request, the job is now successfully canceled.""" NOT_RESPONDING = "NotResponding" """When heartbeat is enabled, if the run isn't updating any information to RunHistory then the run - #: goes to NotResponding state. - #: NotResponding is the only state that is exempt from strict transition orders. A run can go from - #: NotResponding to any of the previous states.""" + goes to NotResponding state. + NotResponding is the only state that is exempt from strict transition orders. A run can go from + NotResponding to any of the previous states.""" PAUSED = "Paused" """The job is paused by users. Some adjustment to labeling jobs can be made only in paused state.""" UNKNOWN = "Unknown" """Default job status if not mapped to all other statuses""" +class JobTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the job tier.""" + + NULL = "Null" + SPOT = "Spot" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + + class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine the type of job.""" @@ -685,6 +1078,8 @@ class JobType(str, Enum, metaclass=CaseInsensitiveEnumMeta): COMMAND = "Command" SWEEP = "Sweep" PIPELINE = "Pipeline" + SPARK = "Spark" + FINE_TUNING = "FineTuning" class KeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -737,6 +1132,29 @@ class LogVerbosity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Only critical statements logged.""" +class ManagedNetworkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status for the managed network of a machine learning workspace.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + + +class ManagedPERequirement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPERequirement.""" + + REQUIRED = "Required" + NOT_REQUIRED = "NotRequired" + NOT_APPLICABLE = "NotApplicable" + + +class ManagedPEStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPEStatus.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + NOT_APPLICABLE = "NotApplicable" + + class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). @@ -748,6 +1166,69 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class MarketplaceSubscriptionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MarketplaceSubscriptionProvisioningState.""" + + CREATING = "Creating" + """MarketplaceSubscription is being created.""" + DELETING = "Deleting" + """MarketplaceSubscription is being deleted.""" + SUCCEEDED = "Succeeded" + """MarketplaceSubscription is successfully provisioned.""" + FAILED = "Failed" + """MarketplaceSubscription provisioning failed.""" + UPDATING = "Updating" + """MarketplaceSubscription is being updated.""" + CANCELED = "Canceled" + + +class MarketplaceSubscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MarketplaceSubscriptionStatus.""" + + SUBSCRIBED = "Subscribed" + """The customer can now use the Marketplace Subscription's + model and will be billed.""" + SUSPENDED = "Suspended" + """The customer could not be billed for the Marketplace Subscription. + The customer will not be able to access the model.""" + UNSUBSCRIBED = "Unsubscribed" + """Marketplace Subscriptions reach this state in response to an explicit customer or CSP action. + A Marketplace Subscription can also be canceled implicitly, as a result of nonpayment of dues, + after being in the Suspended state for some time.""" + + +class MaterializationStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MaterializationStoreType.""" + + NONE = "None" + ONLINE = "Online" + OFFLINE = "Offline" + ONLINE_AND_OFFLINE = "OnlineAndOffline" + + +class MlflowAutologger(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Indicates whether mlflow autologger is enabled for notebooks.""" + + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ModelLifecycleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Model lifecycle status.""" + + GENERALLY_AVAILABLE = "GenerallyAvailable" + PREVIEW = "Preview" + + +class ModelProvider(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the type of fine tuning.""" + + AZURE_OPEN_AI = "AzureOpenAI" + """Fine tuning using Azure Open AI model.""" + CUSTOM = "Custom" + """Fine tuning using custom model.""" + + class ModelSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Image model size.""" @@ -763,6 +1244,85 @@ class ModelSize(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Extra large size.""" +class ModelTaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Model task type enum.""" + + CLASSIFICATION = "Classification" + REGRESSION = "Regression" + + +class MonitorComputeIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Monitor compute identity type enum.""" + + AML_TOKEN = "AmlToken" + """Authenticates through user's AML token.""" + MANAGED_IDENTITY = "ManagedIdentity" + """Authenticates through a user-provided managed identity.""" + + +class MonitorComputeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Monitor compute type enum.""" + + SERVERLESS_SPARK = "ServerlessSpark" + """Serverless Spark compute.""" + + +class MonitoringFeatureDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringFeatureDataType.""" + + NUMERICAL = "Numerical" + """Used for features of numerical data type.""" + CATEGORICAL = "Categorical" + """Used for features of categorical data type.""" + + +class MonitoringFeatureFilterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringFeatureFilterType.""" + + ALL_FEATURES = "AllFeatures" + """Includes all features.""" + TOP_N_BY_ATTRIBUTION = "TopNByAttribution" + """Only includes the top contributing features, measured by feature attribution.""" + FEATURE_SUBSET = "FeatureSubset" + """Includes a user-defined subset of features.""" + + +class MonitoringInputDataType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Monitoring input data type enum.""" + + STATIC = "Static" + """An input data with a fixed window size.""" + ROLLING = "Rolling" + """An input data which rolls relatively to the monitor's current run time.""" + FIXED = "Fixed" + """An input data with tabular format which doesn't require preprocessing.""" + + +class MonitoringNotificationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringNotificationType.""" + + AML_NOTIFICATION = "AmlNotification" + """Enables email notifications through AML notifications.""" + + +class MonitoringSignalType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """MonitoringSignalType.""" + + DATA_DRIFT = "DataDrift" + """Tracks model input data distribution change, comparing against training data or past production + data.""" + PREDICTION_DRIFT = "PredictionDrift" + """Tracks prediction result data distribution change, comparing against validation/test label data + or past production data.""" + DATA_QUALITY = "DataQuality" + """Tracks model input data integrity.""" + FEATURE_ATTRIBUTION_DRIFT = "FeatureAttributionDrift" + """Tracks feature importance change in production, comparing against feature importance at + training time.""" + CUSTOM = "Custom" + """Tracks a custom signal provided by users.""" + + class MountAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Mount Action.""" @@ -770,6 +1330,13 @@ class MountAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): UNMOUNT = "Unmount" +class MountMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Mount Mode.""" + + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + + class MountState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Mount state.""" @@ -786,7 +1353,7 @@ class NCrossValidationsMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): AUTO = "Auto" """Determine N-Cross validations value automatically. Supported only for 'Forecasting' AutoML - #: task.""" + task.""" CUSTOM = "Custom" """Use custom N-Cross validations value.""" @@ -817,12 +1384,55 @@ class NodesValueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "All" +class NumericalDataDriftMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """NumericalDataDriftMetric.""" + + JENSEN_SHANNON_DISTANCE = "JensenShannonDistance" + """The Jensen Shannon Distance (JSD) metric.""" + POPULATION_STABILITY_INDEX = "PopulationStabilityIndex" + """The Population Stability Index (PSI) metric.""" + NORMALIZED_WASSERSTEIN_DISTANCE = "NormalizedWassersteinDistance" + """The Normalized Wasserstein Distance metric.""" + TWO_SAMPLE_KOLMOGOROV_SMIRNOV_TEST = "TwoSampleKolmogorovSmirnovTest" + """The Two Sample Kolmogorov-Smirnov Test (two-sample K–S) metric.""" + + +class NumericalDataQualityMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """NumericalDataQualityMetric.""" + + NULL_VALUE_RATE = "NullValueRate" + """Calculates the rate of null values.""" + DATA_TYPE_ERROR_RATE = "DataTypeErrorRate" + """Calculates the rate of data type errors.""" + OUT_OF_BOUNDS_RATE = "OutOfBoundsRate" + """Calculates the rate values are out of bounds.""" + + +class NumericalPredictionDriftMetric(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """NumericalPredictionDriftMetric.""" + + JENSEN_SHANNON_DISTANCE = "JensenShannonDistance" + """The Jensen Shannon Distance (JSD) metric.""" + POPULATION_STABILITY_INDEX = "PopulationStabilityIndex" + """The Population Stability Index (PSI) metric.""" + NORMALIZED_WASSERSTEIN_DISTANCE = "NormalizedWassersteinDistance" + """The Normalized Wasserstein Distance metric.""" + TWO_SAMPLE_KOLMOGOROV_SMIRNOV_TEST = "TwoSampleKolmogorovSmirnovTest" + """The Two Sample Kolmogorov-Smirnov Test (two-sample K–S) metric.""" + + class ObjectDetectionPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Primary metrics for Image ObjectDetection task.""" MEAN_AVERAGE_PRECISION = "MeanAveragePrecision" """Mean Average Precision (MAP) is the average of AP (Average Precision). - #: AP is calculated for each class and averaged to get the MAP.""" + AP is calculated for each class and averaged to get the MAP.""" + + +class OneLakeArtifactType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine OneLake artifact type.""" + + LAKE_HOUSE = "LakeHouse" class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -839,6 +1449,7 @@ class OperationName(str, Enum, metaclass=CaseInsensitiveEnumMeta): START = "Start" STOP = "Stop" RESTART = "Restart" + RESIZE = "Resize" REIMAGE = "Reimage" DELETE = "Delete" @@ -852,6 +1463,7 @@ class OperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): START_FAILED = "StartFailed" STOP_FAILED = "StopFailed" RESTART_FAILED = "RestartFailed" + RESIZE_FAILED = "ResizeFailed" REIMAGE_FAILED = "ReimageFailed" DELETE_FAILED = "DeleteFailed" @@ -873,6 +1485,16 @@ class OrderString(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATED_AT_ASC = "UpdatedAtAsc" +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + SYSTEM = "system" + USER_SYSTEM = "user,system" + + class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Compute OS Type.""" @@ -885,6 +1507,17 @@ class OutputDeliveryMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): READ_WRITE_MOUNT = "ReadWriteMount" UPLOAD = "Upload" + DIRECT = "Direct" + + +class PatchStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The os patching status.""" + + COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + UNKNOWN = "Unknown" class PendingUploadCredentialType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -900,23 +1533,24 @@ class PendingUploadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): TEMPORARY_BLOB_REFERENCE = "TemporaryBlobReference" -class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current provisioning state.""" +class PoolProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of pool related resources provisioning.""" - SUCCEEDED = "Succeeded" CREATING = "Creating" DELETING = "Deleting" + SUCCEEDED = "Succeeded" FAILED = "Failed" + UPDATING = "Updating" + CANCELED = "Canceled" -class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The private endpoint connection status.""" +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" - PENDING = "Pending" - APPROVED = "Approved" - REJECTED = "Rejected" - DISCONNECTED = "Disconnected" - TIMEOUT = "Timeout" + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -928,8 +1562,8 @@ class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current deployment state of workspace resource. The provisioningState is to indicate states - for resource provisioning. + """The provision state of the cluster. Valid values are Unknown, Updating, Provisioning, + Succeeded, and Failed. """ UNKNOWN = "Unknown" @@ -949,13 +1583,6 @@ class ProvisioningStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" -class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Whether requests from Public Network are allowed.""" - - ENABLED = "Enabled" - DISABLED = "Disabled" - - class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enum to determine whether PublicNetworkAccess is Enabled or Disabled.""" @@ -969,6 +1596,28 @@ class QuotaUnit(str, Enum, metaclass=CaseInsensitiveEnumMeta): COUNT = "Count" +class RaiPolicyContentSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Content source to apply the Content Filters.""" + + PROMPT = "Prompt" + COMPLETION = "Completion" + + +class RaiPolicyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Content Filters mode.""" + + DEFAULT = "Default" + DEFERRED = "Deferred" + BLOCKING = "Blocking" + + +class RaiPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Content Filters policy type.""" + + USER_MANAGED = "UserManaged" + SYSTEM_MANAGED = "SystemManaged" + + class RandomSamplingAlgorithmRule(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The specific type of random algorithm.""" @@ -1004,43 +1653,43 @@ class RegressionModels(str, Enum, metaclass=CaseInsensitiveEnumMeta): ELASTIC_NET = "ElasticNet" """Elastic net is a popular type of regularized linear regression that combines two popular - #: penalties, specifically the L1 and L2 penalty functions.""" + penalties, specifically the L1 and L2 penalty functions.""" GRADIENT_BOOSTING = "GradientBoosting" """The technique of transiting week learners into a strong learner is called Boosting. The - #: gradient boosting algorithm process works on this theory of execution.""" + gradient boosting algorithm process works on this theory of execution.""" DECISION_TREE = "DecisionTree" """Decision Trees are a non-parametric supervised learning method used for both classification and - #: regression tasks. - #: The goal is to create a model that predicts the value of a target variable by learning simple - #: decision rules inferred from the data features.""" + regression tasks. + The goal is to create a model that predicts the value of a target variable by learning simple + decision rules inferred from the data features.""" KNN = "KNN" """K-nearest neighbors (KNN) algorithm uses 'feature similarity' to predict the values of new - #: datapoints - #: which further means that the new data point will be assigned a value based on how closely it - #: matches the points in the training set.""" + datapoints + which further means that the new data point will be assigned a value based on how closely it + matches the points in the training set.""" LASSO_LARS = "LassoLars" """Lasso model fit with Least Angle Regression a.k.a. Lars. It is a Linear Model trained with an - #: L1 prior as regularizer.""" + L1 prior as regularizer.""" SGD = "SGD" """SGD: Stochastic gradient descent is an optimization algorithm often used in machine learning - #: applications - #: to find the model parameters that correspond to the best fit between predicted and actual - #: outputs. - #: It's an inexact but powerful technique.""" + applications + to find the model parameters that correspond to the best fit between predicted and actual + outputs. + It's an inexact but powerful technique.""" RANDOM_FOREST = "RandomForest" """Random forest is a supervised learning algorithm. - #: The "forest"\ it builds, is an ensemble of decision trees, usually trained with the “bagging”\ - #: method. - #: The general idea of the bagging method is that a combination of learning models increases the - #: overall result.""" + The "forest" it builds, is an ensemble of decision trees, usually trained with the "bagging" + method. + The general idea of the bagging method is that a combination of learning models increases the + overall result.""" EXTREME_RANDOM_TREES = "ExtremeRandomTrees" """Extreme Trees is an ensemble machine learning algorithm that combines the predictions from many - #: decision trees. It is related to the widely used random forest algorithm.""" + decision trees. It is related to the widely used random forest algorithm.""" LIGHT_GBM = "LightGBM" """LightGBM is a gradient boosting framework that uses tree based learning algorithms.""" XG_BOOST_REGRESSOR = "XGBoostRegressor" """XGBoostRegressor: Extreme Gradient Boosting Regressor is a supervised machine learning model - #: using ensemble of base learners.""" + using ensemble of base learners.""" class RegressionPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1050,13 +1699,13 @@ class RegressionPrimaryMetrics(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The Spearman's rank coefficient of correlation is a nonparametric measure of rank correlation.""" NORMALIZED_ROOT_MEAN_SQUARED_ERROR = "NormalizedRootMeanSquaredError" """The Normalized Root Mean Squared Error (NRMSE) the RMSE facilitates the comparison between - #: models with different scales.""" + models with different scales.""" R2_SCORE = "R2Score" """The R2 score is one of the performance evaluation measures for forecasting-based machine - #: learning models.""" + learning models.""" NORMALIZED_MEAN_ABSOLUTE_ERROR = "NormalizedMeanAbsoluteError" """The Normalized Mean Absolute Error (NMAE) is a validation metric to compare the Mean Absolute - #: Error (MAE) of (time) series with different scales.""" + Error (MAE) of (time) series with different scales.""" class RemoteLoginPortPublicAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1073,6 +1722,47 @@ class RemoteLoginPortPublicAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): NOT_SPECIFIED = "NotSpecified" +class RollingRateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """RollingRateType.""" + + YEAR = "Year" + MONTH = "Month" + DAY = "Day" + HOUR = "Hour" + MINUTE = "Minute" + + +class RuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The action enum for networking rule.""" + + ALLOW = "Allow" + DENY = "Deny" + + +class RuleCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Category of a managed network Outbound Rule of a machine learning workspace.""" + + REQUIRED = "Required" + RECOMMENDED = "Recommended" + USER_DEFINED = "UserDefined" + DEPENDENCY = "Dependency" + + +class RuleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of a managed network Outbound Rule of a machine learning workspace.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + + +class RuleType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of a managed network Outbound Rule of a machine learning workspace.""" + + FQDN = "FQDN" + PRIVATE_ENDPOINT = "PrivateEndpoint" + SERVICE_TAG = "ServiceTag" + + class SamplingAlgorithmType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SamplingAlgorithmType.""" @@ -1093,6 +1783,7 @@ class ScheduleActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CREATE_JOB = "CreateJob" INVOKE_BATCH_ENDPOINT = "InvokeBatchEndpoint" + CREATE_MONITOR = "CreateMonitor" class ScheduleListViewType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1147,6 +1838,33 @@ class SecretsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SERVICE_PRINCIPAL = "ServicePrincipal" +class ServerlessEndpointState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the Serverless Endpoint.""" + + UNKNOWN = "Unknown" + CREATING = "Creating" + DELETING = "Deleting" + SUSPENDING = "Suspending" + REINSTATING = "Reinstating" + ONLINE = "Online" + SUSPENDED = "Suspended" + CREATION_FAILED = "CreationFailed" + DELETION_FAILED = "DeletionFailed" + + +class ServerlessInferenceEndpointAuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ServerlessInferenceEndpointAuthMode.""" + + KEY = "Key" + + +class ServiceAccountKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ServiceAccountKeyName.""" + + KEY1 = "Key1" + KEY2 = "Key2" + + class ServiceDataAccessAuthIdentity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ServiceDataAccessAuthIdentity.""" @@ -1165,7 +1883,7 @@ class ShortSeriesHandlingConfiguration(str, Enum, metaclass=CaseInsensitiveEnumM """Represents no/null value.""" AUTO = "Auto" """Short series will be padded if there are no long series, otherwise short series will be - #: dropped.""" + dropped.""" PAD = "Pad" """All the short series will be padded.""" DROP = "Drop" @@ -1202,6 +1920,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 @@ -1265,7 +1990,7 @@ class StochasticOptimizer(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Stochastic Gradient Descent optimizer.""" ADAM = "Adam" """Adam is algorithm the optimizes stochastic objective functions based on adaptive estimates of - #: moments""" + moments""" ADAMW = "Adamw" """AdamW is a variant of the optimizer Adam that has an improved implementation of weight decay.""" @@ -1277,6 +2002,14 @@ class StorageAccountType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PREMIUM_LRS = "Premium_LRS" +class SystemDatastoresAuthMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The auth mode used for accessing the system datastores of the workspace.""" + + ACCESS_KEY = "AccessKey" + IDENTITY = "Identity" + USER_DELEGATION_SAS = "UserDelegationSAS" + + class TargetAggregationFunction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Target aggregate function.""" @@ -1311,42 +2044,42 @@ class TaskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): CLASSIFICATION = "Classification" """Classification in machine learning and statistics is a supervised learning approach in which - #: the computer program learns from the data given to it and make new observations or - #: classifications.""" + the computer program learns from the data given to it and make new observations or + classifications.""" REGRESSION = "Regression" """Regression means to predict the value using the input data. Regression models are used to - #: predict a continuous value.""" + predict a continuous value.""" FORECASTING = "Forecasting" """Forecasting is a special kind of regression task that deals with time-series data and creates - #: forecasting model - #: that can be used to predict the near future values based on the inputs.""" + forecasting model + that can be used to predict the near future values based on the inputs.""" IMAGE_CLASSIFICATION = "ImageClassification" """Image Classification. Multi-class image classification is used when an image is classified with - #: only a single label - #: from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' - #: or a 'duck'.""" + only a single label + from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' + or a 'duck'.""" IMAGE_CLASSIFICATION_MULTILABEL = "ImageClassificationMultilabel" """Image Classification Multilabel. Multi-label image classification is used when an image could - #: have one or more labels - #: from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'.""" + have one or more labels + from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'.""" IMAGE_OBJECT_DETECTION = "ImageObjectDetection" """Image Object Detection. Object detection is used to identify objects in an image and locate - #: each object with a - #: bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each.""" + each object with a + bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each.""" IMAGE_INSTANCE_SEGMENTATION = "ImageInstanceSegmentation" """Image Instance Segmentation. Instance segmentation is used to identify objects in an image at - #: the pixel level, - #: drawing a polygon around each object in the image.""" + the pixel level, + drawing a polygon around each object in the image.""" TEXT_CLASSIFICATION = "TextClassification" """Text classification (also known as text tagging or text categorization) is the process of - #: sorting texts into categories. - #: Categories are mutually exclusive.""" + sorting texts into categories. + Categories are mutually exclusive.""" TEXT_CLASSIFICATION_MULTILABEL = "TextClassificationMultilabel" """Multilabel classification task assigns each sample to a group (zero or more) of target labels.""" TEXT_NER = "TextNER" """Text Named Entity Recognition a.k.a. TextNER. - #: Named Entity Recognition (NER) is the ability to take free-form text and identify the - #: occurrences of entities such as people, locations, organizations, and more.""" + Named Entity Recognition (NER) is the ability to take free-form text and identify the + occurrences of entities such as people, locations, organizations, and more.""" class TriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -1397,12 +2130,6 @@ class ValidationMetricType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """CocoVoc metric.""" -class ValueFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """format for the workspace connection value.""" - - JSON = "JSON" - - class VMPriceOSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Operating system type used by the VM.""" @@ -1434,6 +2161,12 @@ class VolumeDefinitionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NPIPE = "npipe" +class WebhookType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Enum to determine the webhook callback service type.""" + + AZURE_DEV_OPS = "AzureDevOps" + + 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 736189ee685..78b40e9dde7 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,6 +24,671 @@ JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +class WorkspaceConnectionPropertiesV2(_serialization.Model): # pylint: disable=too-many-instance-attributes + """WorkspaceConnectionPropertiesV2. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AADAuthTypeWorkspaceConnectionProperties, AccessKeyAuthTypeWorkspaceConnectionProperties, + AccountKeyAuthTypeWorkspaceConnectionProperties, ApiKeyAuthWorkspaceConnectionProperties, + CustomKeysWorkspaceConnectionProperties, ManagedIdentityAuthTypeWorkspaceConnectionProperties, + NoneAuthTypeWorkspaceConnectionProperties, OAuth2AuthTypeWorkspaceConnectionProperties, + PATAuthTypeWorkspaceConnectionProperties, SASAuthTypeWorkspaceConnectionProperties, + ServicePrincipalAuthTypeWorkspaceConnectionProperties, + UsernamePasswordAuthTypeWorkspaceConnectionProperties + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + _subtype_map = { + "auth_type": { + "AAD": "AADAuthTypeWorkspaceConnectionProperties", + "AccessKey": "AccessKeyAuthTypeWorkspaceConnectionProperties", + "AccountKey": "AccountKeyAuthTypeWorkspaceConnectionProperties", + "ApiKey": "ApiKeyAuthWorkspaceConnectionProperties", + "CustomKeys": "CustomKeysWorkspaceConnectionProperties", + "ManagedIdentity": "ManagedIdentityAuthTypeWorkspaceConnectionProperties", + "None": "NoneAuthTypeWorkspaceConnectionProperties", + "OAuth2": "OAuth2AuthTypeWorkspaceConnectionProperties", + "PAT": "PATAuthTypeWorkspaceConnectionProperties", + "SAS": "SASAuthTypeWorkspaceConnectionProperties", + "ServicePrincipal": "ServicePrincipalAuthTypeWorkspaceConnectionProperties", + "UsernamePassword": "UsernamePasswordAuthTypeWorkspaceConnectionProperties", + } + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + self.category = category + self.created_by_workspace_arm_id = None + self.error = error + self.expiry_time = expiry_time + self.group = None + self.is_shared_to_all = is_shared_to_all + self.metadata = metadata + self.pe_requirement = pe_requirement + self.pe_status = pe_status + self.shared_user_list = shared_user_list + self.target = target + self.use_workspace_managed_identity = use_workspace_managed_identity + + +class AADAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes + """This connection type covers the AAD auth for any applicable Azure service. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AAD" + + +class AccessKeyAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """AccessKeyAuthTypeWorkspaceConnectionProperties. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionAccessKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionAccessKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccessKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccessKey" + self.credentials = credentials + + +class AccountApiKeys(_serialization.Model): + """AccountApiKeys. + + :ivar key1: + :vartype key1: str + :ivar key2: + :vartype key2: str + """ + + _attribute_map = { + "key1": {"key": "key1", "type": "str"}, + "key2": {"key": "key2", "type": "str"}, + } + + def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key1: + :paramtype key1: str + :keyword key2: + :paramtype key2: str + """ + super().__init__(**kwargs) + self.key1 = key1 + self.key2 = key2 + + +class AccountKeyAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """This connection type covers the account key connection for Azure storage. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Account key object for workspace connection credential. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionAccountKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionAccountKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Account key object for workspace connection credential. + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionAccountKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccountKey" + self.credentials = credentials + + class DatastoreCredentials(_serialization.Model): """Base definition for datastore credentials. @@ -31,7 +696,7 @@ class DatastoreCredentials(_serialization.Model): AccountKeyDatastoreCredentials, CertificateDatastoreCredentials, NoneDatastoreCredentials, SasDatastoreCredentials, ServicePrincipalDatastoreCredentials - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar credentials_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". @@ -65,7 +730,7 @@ def __init__(self, **kwargs: Any) -> None: class AccountKeyDatastoreCredentials(DatastoreCredentials): """Account key datastore credentials configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar credentials_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". @@ -101,7 +766,7 @@ class DatastoreSecrets(_serialization.Model): AccountKeyDatastoreSecrets, CertificateDatastoreSecrets, SasDatastoreSecrets, ServicePrincipalDatastoreSecrets - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". @@ -134,7 +799,7 @@ def __init__(self, **kwargs: Any) -> None: class AccountKeyDatastoreSecrets(DatastoreSecrets): """Datastore account key secrets. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". @@ -202,6 +867,44 @@ def __init__( self.user_created_acr_account = user_created_acr_account +class ActualCapacityInfo(_serialization.Model): + """ActualCapacityInfo. + + :ivar allocated: Gets or sets the total number of instances for the group. + :vartype allocated: int + :ivar assignment_failed: Gets or sets the number of instances which failed to successfully + complete assignment. + :vartype assignment_failed: int + :ivar assignment_success: Gets or sets the number of instances which successfully completed + assignment. + :vartype assignment_success: int + """ + + _attribute_map = { + "allocated": {"key": "allocated", "type": "int"}, + "assignment_failed": {"key": "assignmentFailed", "type": "int"}, + "assignment_success": {"key": "assignmentSuccess", "type": "int"}, + } + + def __init__( + self, *, allocated: int = 0, assignment_failed: int = 0, assignment_success: int = 0, **kwargs: Any + ) -> None: + """ + :keyword allocated: Gets or sets the total number of instances for the group. + :paramtype allocated: int + :keyword assignment_failed: Gets or sets the number of instances which failed to successfully + complete assignment. + :paramtype assignment_failed: int + :keyword assignment_success: Gets or sets the number of instances which successfully completed + assignment. + :paramtype assignment_success: int + """ + super().__init__(**kwargs) + self.allocated = allocated + self.assignment_failed = assignment_failed + self.assignment_success = assignment_success + + class AKSSchema(_serialization.Model): """AKSSchema. @@ -231,7 +934,7 @@ class Compute(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", "HDInsight", "Databricks", @@ -337,7 +1040,7 @@ class AKS(Compute, AKSSchema): # pylint: disable=too-many-instance-attributes 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. + All required parameters must be populated in order to send to server. :ivar properties: AKS properties. :vartype properties: ~azure.mgmt.machinelearningservices.models.AKSSchemaProperties @@ -486,7 +1189,7 @@ class ComputeSecrets(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AksComputeSecrets, DatabricksComputeSecrets, VirtualMachineSecrets - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", "HDInsight", "Databricks", @@ -519,7 +1222,7 @@ def __init__(self, **kwargs: Any) -> None: class AksComputeSecrets(ComputeSecrets, AksComputeSecretsProperties): """Secrets related to a Machine Learning compute based on AKS. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar user_kube_config: Content of kubeconfig file that can be used to connect to the Kubernetes cluster. @@ -728,66 +1431,129 @@ def __init__( self.load_balancer_subnet = load_balancer_subnet -class Nodes(_serialization.Model): - """Abstract Nodes definition. +class MonitoringFeatureFilterBase(_serialization.Model): + """MonitoringFeatureFilterBase. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AllNodes + AllFeatures, FeatureSubset, TopNFeaturesByAttribution - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" - :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType + :ivar filter_type: [Required] Specifies the feature filter to leverage when selecting features + to calculate metrics over. Required. Known values are: "AllFeatures", "TopNByAttribution", and + "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType """ _validation = { - "nodes_value_type": {"required": True}, + "filter_type": {"required": True}, } _attribute_map = { - "nodes_value_type": {"key": "nodesValueType", "type": "str"}, + "filter_type": {"key": "filterType", "type": "str"}, } - _subtype_map = {"nodes_value_type": {"All": "AllNodes"}} + _subtype_map = { + "filter_type": { + "AllFeatures": "AllFeatures", + "FeatureSubset": "FeatureSubset", + "TopNByAttribution": "TopNFeaturesByAttribution", + } + } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.nodes_value_type: Optional[str] = None + self.filter_type: Optional[str] = None -class AllNodes(Nodes): - """All nodes means the service will be running on all of the nodes of the job. +class AllFeatures(MonitoringFeatureFilterBase): + """AllFeatures. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" - :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType + :ivar filter_type: [Required] Specifies the feature filter to leverage when selecting features + to calculate metrics over. Required. Known values are: "AllFeatures", "TopNByAttribution", and + "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType """ _validation = { - "nodes_value_type": {"required": True}, + "filter_type": {"required": True}, } _attribute_map = { - "nodes_value_type": {"key": "nodesValueType", "type": "str"}, + "filter_type": {"key": "filterType", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.nodes_value_type: str = "All" + self.filter_type: str = "AllFeatures" -class AmlComputeSchema(_serialization.Model): - """Properties(top level) of AmlCompute. +class Nodes(_serialization.Model): + """Abstract Nodes definition. - :ivar properties: Properties of AmlCompute. - :vartype properties: ~azure.mgmt.machinelearningservices.models.AmlComputeProperties + 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 server. + + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" + :vartype nodes_value_type: str or ~azure.mgmt.machinelearningservices.models.NodesValueType """ - _attribute_map = { - "properties": {"key": "properties", "type": "AmlComputeProperties"}, + _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: Any) -> None: + """ """ + 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 server. + + :ivar nodes_value_type: [Required] Type of the Nodes value. Required. "All" + :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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.nodes_value_type: str = "All" + + +class AmlComputeSchema(_serialization.Model): + """Properties(top level) of AmlCompute. + + :ivar properties: Properties of AmlCompute. + :vartype properties: ~azure.mgmt.machinelearningservices.models.AmlComputeProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "AmlComputeProperties"}, } def __init__(self, *, properties: Optional["_models.AmlComputeProperties"] = None, **kwargs: Any) -> None: @@ -804,7 +1570,7 @@ class AmlCompute(Compute, AmlComputeSchema): # pylint: disable=too-many-instanc 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. + All required parameters must be populated in order to send to server. :ivar properties: Properties of AmlCompute. :vartype properties: ~azure.mgmt.machinelearningservices.models.AmlComputeProperties @@ -1147,119 +1913,13 @@ def __init__( self.property_bag = property_bag -class AmlOperation(_serialization.Model): - """Azure Machine Learning workspace REST API operation. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: Display name of operation. - :vartype display: ~azure.mgmt.machinelearningservices.models.AmlOperationDisplay - :ivar is_data_action: Indicates whether the operation applies to data-plane. - :vartype is_data_action: bool - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "AmlOperationDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - display: Optional["_models.AmlOperationDisplay"] = None, - is_data_action: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Operation name: {provider}/{resource}/{operation}. - :paramtype name: str - :keyword display: Display name of operation. - :paramtype display: ~azure.mgmt.machinelearningservices.models.AmlOperationDisplay - :keyword is_data_action: Indicates whether the operation applies to data-plane. - :paramtype is_data_action: bool - """ - super().__init__(**kwargs) - self.name = name - self.display = display - self.is_data_action = is_data_action - - -class AmlOperationDisplay(_serialization.Model): - """Display name of operation. - - :ivar provider: The resource provider name: Microsoft.MachineLearningExperimentation. - :vartype provider: str - :ivar resource: The resource on which the operation is performed. - :vartype resource: str - :ivar operation: The operation that users can perform. - :vartype operation: str - :ivar description: The description for the operation. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: The resource provider name: Microsoft.MachineLearningExperimentation. - :paramtype provider: str - :keyword resource: The resource on which the operation is performed. - :paramtype resource: str - :keyword operation: The operation that users can perform. - :paramtype operation: str - :keyword description: The description for the operation. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -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. - :vartype value: list[~azure.mgmt.machinelearningservices.models.AmlOperation] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AmlOperation]"}, - } - - def __init__(self, *, value: Optional[List["_models.AmlOperation"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of AML workspace operations supported by the AML workspace resource - provider. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.AmlOperation] - """ - super().__init__(**kwargs) - self.value = value - - class IdentityConfiguration(_serialization.Model): """Base definition for identity configuration. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AmlToken, ManagedIdentity, UserIdentity - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar identity_type: [Required] Specifies the type of identity framework. Required. Known values are: "Managed", "AMLToken", and "UserIdentity". @@ -1288,7 +1948,7 @@ def __init__(self, **kwargs: Any) -> None: class AmlToken(IdentityConfiguration): """AML Token identity configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar identity_type: [Required] Specifies the type of identity framework. Required. Known values are: "Managed", "AMLToken", and "UserIdentity". @@ -1310,6 +1970,63 @@ def __init__(self, **kwargs: Any) -> None: self.identity_type: str = "AMLToken" +class MonitorComputeIdentityBase(_serialization.Model): + """Monitor compute identity base definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AmlTokenComputeIdentity, ManagedComputeIdentity + + All required parameters must be populated in order to send to server. + + :ivar compute_identity_type: [Required] Specifies the type of identity to use within the + monitoring jobs. Required. Known values are: "AmlToken" and "ManagedIdentity". + :vartype compute_identity_type: str or + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType + """ + + _validation = { + "compute_identity_type": {"required": True}, + } + + _attribute_map = { + "compute_identity_type": {"key": "computeIdentityType", "type": "str"}, + } + + _subtype_map = { + "compute_identity_type": {"AmlToken": "AmlTokenComputeIdentity", "ManagedIdentity": "ManagedComputeIdentity"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.compute_identity_type: Optional[str] = None + + +class AmlTokenComputeIdentity(MonitorComputeIdentityBase): + """AML token compute identity definition. + + All required parameters must be populated in order to send to server. + + :ivar compute_identity_type: [Required] Specifies the type of identity to use within the + monitoring jobs. Required. Known values are: "AmlToken" and "ManagedIdentity". + :vartype compute_identity_type: str or + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType + """ + + _validation = { + "compute_identity_type": {"required": True}, + } + + _attribute_map = { + "compute_identity_type": {"key": "computeIdentityType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.compute_identity_type: str = "AmlToken" + + class AmlUserFeature(_serialization.Model): """Features enabled for a workspace. @@ -1349,13 +2066,254 @@ def __init__( self.description = description +class DataReferenceCredential(_serialization.Model): + """DataReferenceCredential base class. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DockerCredential, ManagedIdentityCredential, AnonymousAccessCredential, SASCredential + + All required parameters must be populated in order to send to server. + + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "SAS", "DockerCredentials", "ManagedIdentity", and "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + """ + + _validation = { + "credential_type": {"required": True}, + } + + _attribute_map = { + "credential_type": {"key": "credentialType", "type": "str"}, + } + + _subtype_map = { + "credential_type": { + "DockerCredentials": "DockerCredential", + "ManagedIdentity": "ManagedIdentityCredential", + "NoCredentials": "AnonymousAccessCredential", + "SAS": "SASCredential", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.credential_type: Optional[str] = None + + +class AnonymousAccessCredential(DataReferenceCredential): + """Access credential with no credentials. + + All required parameters must be populated in order to send to server. + + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "SAS", "DockerCredentials", "ManagedIdentity", and "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + """ + + _validation = { + "credential_type": {"required": True}, + } + + _attribute_map = { + "credential_type": {"key": "credentialType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.credential_type: str = "NoCredentials" + + +class ApiKeyAuthWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes + """This connection type covers the generic ApiKey auth connection categories, for examples: + AzureOpenAI: + Category:= AzureOpenAI + AuthType:= ApiKey (as type discriminator) + Credentials:= {ApiKey} as + Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey + Target:= {ApiBase} + + CognitiveService: + Category:= CognitiveService + AuthType:= ApiKey (as type discriminator) + Credentials:= {SubscriptionKey} as + Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey + Target:= ServiceRegion={serviceRegion} + + CognitiveSearch: + Category:= CognitiveSearch + AuthType:= ApiKey (as type discriminator) + Credentials:= {Key} as + Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.ApiKey + Target:= {Endpoint} + + Use Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Api key object for workspace connection credential. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionApiKey"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionApiKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Api key object for workspace connection credential. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionApiKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ApiKey" + self.credentials = credentials + + 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}" + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" # pylint: disable=line-too-long or - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". # pylint: disable=line-too-long :vartype resource_id: str """ @@ -1366,9 +2324,9 @@ class ArmResourceId(_serialization.Model): def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_id: Arm ResourceId is in the format - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Storage/storageAccounts/{StorageAccountName}" # pylint: disable=line-too-long or - "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". + "/subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{AcrName}". # pylint: disable=line-too-long :paramtype resource_id: str """ super().__init__(**kwargs) @@ -1525,7 +2483,7 @@ def __init__( class AssetJobInput(_serialization.Model): """Asset input type. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", "Download", "Direct", "EvalMount", and "EvalDownload". @@ -1561,13 +2519,17 @@ def __init__( 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 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"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -1575,17 +2537,22 @@ class AssetJobOutput(_serialization.Model): def __init__( self, *, + asset_name: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". + :keyword asset_name: Output Asset Name. + :paramtype asset_name: 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.mode = mode self.uri = uri @@ -1596,7 +2563,7 @@ class AssetReferenceBase(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: DataPathAssetReference, IdAssetReference, OutputPathAssetReference - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values are: "Id", "DataPath", and "OutputPath". @@ -1628,7 +2595,7 @@ def __init__(self, **kwargs: Any) -> None: class AssignedUser(_serialization.Model): """A user that can be assigned to a compute instance. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar object_id: User’s AAD Object Id. Required. :vartype object_id: str @@ -1664,7 +2631,7 @@ class ForecastHorizon(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutoForecastHorizon, CustomForecastHorizon - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Set forecast horizon value selection mode. Required. Known values are: "Auto" and "Custom". @@ -1690,7 +2657,7 @@ def __init__(self, **kwargs: Any) -> None: class AutoForecastHorizon(ForecastHorizon): """Forecast horizon determined automatically by system. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Set forecast horizon value selection mode. Required. Known values are: "Auto" and "Custom". @@ -1715,11 +2682,11 @@ class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attr """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, FineTuningJob, PipelineJob, SparkJob, SweepJob 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. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -1743,8 +2710,10 @@ 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", "Sweep", "Pipeline", "Spark", and "FineTuning". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -1770,12 +2739,20 @@ class JobBaseProperties(ResourceBase): # pylint: disable=too-many-instance-attr "identity": {"key": "identity", "type": "IdentityConfiguration"}, "is_archived": {"key": "isArchived", "type": "bool"}, "job_type": {"key": "jobType", "type": "str"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, "services": {"key": "services", "type": "{JobService}"}, "status": {"key": "status", "type": "str"}, } _subtype_map = { - "job_type": {"AutoML": "AutoMLJob", "Command": "CommandJob", "Pipeline": "PipelineJob", "Sweep": "SweepJob"} + "job_type": { + "AutoML": "AutoMLJob", + "Command": "CommandJob", + "FineTuning": "FineTuningJob", + "Pipeline": "PipelineJob", + "Spark": "SparkJob", + "Sweep": "SweepJob", + } } def __init__( @@ -1790,6 +2767,7 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, services: Optional[Dict[str, "_models.JobService"]] = None, **kwargs: Any ) -> None: @@ -1815,6 +2793,8 @@ def __init__( :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -1827,6 +2807,7 @@ def __init__( self.identity = identity self.is_archived = is_archived self.job_type: Optional[str] = None + self.notification_setting = notification_setting self.services = services self.status = None @@ -1838,7 +2819,7 @@ class AutoMLJob(JobBaseProperties): # pylint: disable=too-many-instance-attribu 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. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -1862,8 +2843,10 @@ 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", "Sweep", "Pipeline", "Spark", and "FineTuning". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -1879,6 +2862,8 @@ class AutoMLJob(JobBaseProperties): # pylint: disable=too-many-instance-attribu :vartype environment_variables: dict[str, str] :ivar outputs: Mapping of output data bindings used in the job. :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar queue_settings: Queue settings for the job. + :vartype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings :ivar resources: Compute Resource configuration for the job. :vartype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration :ivar task_details: [Required] This represents scenario which can be one of Tables/NLP/Image. @@ -1903,11 +2888,13 @@ class AutoMLJob(JobBaseProperties): # pylint: disable=too-many-instance-attribu "identity": {"key": "identity", "type": "IdentityConfiguration"}, "is_archived": {"key": "isArchived", "type": "bool"}, "job_type": {"key": "jobType", "type": "str"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, "services": {"key": "services", "type": "{JobService}"}, "status": {"key": "status", "type": "str"}, "environment_id": {"key": "environmentId", "type": "str"}, "environment_variables": {"key": "environmentVariables", "type": "{str}"}, "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, "resources": {"key": "resources", "type": "JobResourceConfiguration"}, "task_details": {"key": "taskDetails", "type": "AutoMLVertical"}, } @@ -1925,10 +2912,12 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, services: Optional[Dict[str, "_models.JobService"]] = None, environment_id: Optional[str] = None, environment_variables: Optional[Dict[str, str]] = None, outputs: Optional[Dict[str, "_models.JobOutput"]] = None, + queue_settings: Optional["_models.QueueSettings"] = None, resources: Optional["_models.JobResourceConfiguration"] = None, **kwargs: Any ) -> None: @@ -1954,6 +2943,8 @@ def __init__( :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -1965,6 +2956,8 @@ def __init__( :paramtype environment_variables: dict[str, str] :keyword outputs: Mapping of output data bindings used in the job. :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword queue_settings: Queue settings for the job. + :paramtype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings :keyword resources: Compute Resource configuration for the job. :paramtype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration :keyword task_details: [Required] This represents scenario which can be one of @@ -1981,6 +2974,7 @@ def __init__( experiment_name=experiment_name, identity=identity, is_archived=is_archived, + notification_setting=notification_setting, services=services, **kwargs ) @@ -1988,6 +2982,7 @@ def __init__( self.environment_id = environment_id self.environment_variables = environment_variables self.outputs = outputs + self.queue_settings = queue_settings self.resources = resources self.task_details = task_details @@ -2001,7 +2996,7 @@ class AutoMLVertical(_serialization.Model): ImageInstanceSegmentation, ImageObjectDetection, Regression, TextClassification, TextClassificationMultilabel, TextNer - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", "Warning", "Error", and "Critical". @@ -2076,7 +3071,7 @@ class NCrossValidations(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutoNCrossValidations, CustomNCrossValidations - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Mode for determining N-Cross validations. Required. Known values are: "Auto" and "Custom". @@ -2102,7 +3097,7 @@ def __init__(self, **kwargs: Any) -> None: class AutoNCrossValidations(NCrossValidations): """N-Cross validations determined automatically. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Mode for determining N-Cross validations. Required. Known values are: "Auto" and "Custom". @@ -2196,7 +3191,7 @@ class Seasonality(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutoSeasonality, CustomSeasonality - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Seasonality mode. Required. Known values are: "Auto" and "Custom". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.SeasonalityMode @@ -2221,7 +3216,7 @@ def __init__(self, **kwargs: Any) -> None: class AutoSeasonality(Seasonality): """AutoSeasonality. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Seasonality mode. Required. Known values are: "Auto" and "Custom". :vartype mode: str or ~azure.mgmt.machinelearningservices.models.SeasonalityMode @@ -2247,7 +3242,7 @@ class TargetLags(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutoTargetLags, CustomTargetLags - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Set target lags mode - Auto/Custom. Required. Known values are: "Auto" and "Custom". @@ -2273,7 +3268,7 @@ def __init__(self, **kwargs: Any) -> None: class AutoTargetLags(TargetLags): """AutoTargetLags. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] Set target lags mode - Auto/Custom. Required. Known values are: "Auto" and "Custom". @@ -2300,7 +3295,7 @@ class TargetRollingWindowSize(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: AutoTargetRollingWindowSize, CustomTargetRollingWindowSize - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] TargetRollingWindowSiz detection mode. Required. Known values are: "Auto" and "Custom". @@ -2326,7 +3321,7 @@ def __init__(self, **kwargs: Any) -> None: class AutoTargetRollingWindowSize(TargetRollingWindowSize): """Target lags rolling window determined automatically. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar mode: [Required] TargetRollingWindowSiz detection mode. Required. Known values are: "Auto" and "Custom". @@ -2351,11 +3346,12 @@ 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, + OneLakeDatastore 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. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -2366,7 +3362,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 "OneLake". :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType :ivar is_default: Readonly property to indicate if datastore is the workspace default datastore. @@ -2394,6 +3390,7 @@ class DatastoreProperties(ResourceBase): "AzureDataLakeGen1": "AzureDataLakeGen1Datastore", "AzureDataLakeGen2": "AzureDataLakeGen2Datastore", "AzureFile": "AzureFileDatastore", + "OneLake": "OneLakeDatastore", } } @@ -2422,27 +3419,59 @@ def __init__( self.is_default = None -class AzureBlobDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes - """Azure Blob datastore configuration. +class AzureDatastore(_serialization.Model): + """Base definition for Azure datastore contents configuration. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar resource_group: Azure Resource Group name. + :vartype resource_group: str + :ivar subscription_id: Azure Subscription Id. + :vartype subscription_id: str + """ - All required parameters must be populated in order to send to Azure. + _attribute_map = { + "resource_group": {"key": "resourceGroup", "type": "str"}, + "subscription_id": {"key": "subscriptionId", "type": "str"}, + } - :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", and "AzureFile". - :vartype datastore_type: str or ~azure.mgmt.machinelearningservices.models.DatastoreType - :ivar is_default: Readonly property to indicate if datastore is the workspace default + def __init__( + self, *, resource_group: Optional[str] = None, subscription_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :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. + + All required parameters must be populated in order to send to server. + + :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 "OneLake". + :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. @@ -2471,6 +3500,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"}, @@ -2485,6 +3516,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, @@ -2501,6 +3534,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. @@ -2515,21 +3552,36 @@ 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. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -2540,11 +3592,15 @@ 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 "OneLake". :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 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". @@ -2568,6 +3624,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"}, } @@ -2580,6 +3638,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: Any ) -> None: @@ -2592,6 +3652,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". @@ -2600,18 +3664,33 @@ 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. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -2622,11 +3701,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 "OneLake". :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. @@ -2657,6 +3740,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"}, @@ -2673,6 +3758,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, @@ -2687,6 +3774,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. @@ -2701,21 +3792,102 @@ 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 Webhook(_serialization.Model): + """Webhook base. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureDevOpsWebhook + + All required parameters must be populated in order to send to server. + + :ivar event_type: Send callback on a specified notification event. + :vartype event_type: str + :ivar webhook_type: [Required] Specifies the type of service to send a callback. Required. + "AzureDevOps" + :vartype webhook_type: str or ~azure.mgmt.machinelearningservices.models.WebhookType + """ + + _validation = { + "webhook_type": {"required": True}, + } + + _attribute_map = { + "event_type": {"key": "eventType", "type": "str"}, + "webhook_type": {"key": "webhookType", "type": "str"}, + } + + _subtype_map = {"webhook_type": {"AzureDevOps": "AzureDevOpsWebhook"}} + + def __init__(self, *, event_type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword event_type: Send callback on a specified notification event. + :paramtype event_type: str + """ + super().__init__(**kwargs) + self.event_type = event_type + self.webhook_type: Optional[str] = None + +class AzureDevOpsWebhook(Webhook): + """Webhook details specific for Azure DevOps. -class AzureFileDatastore(DatastoreProperties): # pylint: disable=too-many-instance-attributes + All required parameters must be populated in order to send to server. + + :ivar event_type: Send callback on a specified notification event. + :vartype event_type: str + :ivar webhook_type: [Required] Specifies the type of service to send a callback. Required. + "AzureDevOps" + :vartype webhook_type: str or ~azure.mgmt.machinelearningservices.models.WebhookType + """ + + _validation = { + "webhook_type": {"required": True}, + } + + _attribute_map = { + "event_type": {"key": "eventType", "type": "str"}, + "webhook_type": {"key": "webhookType", "type": "str"}, + } + + def __init__(self, *, event_type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword event_type: Send callback on a specified notification event. + :paramtype event_type: str + """ + super().__init__(event_type=event_type, **kwargs) + self.webhook_type: str = "AzureDevOps" + + +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. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -2726,11 +3898,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 "OneLake". :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. @@ -2762,6 +3938,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"}, @@ -2778,6 +3956,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, @@ -2792,6 +3972,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. @@ -2807,13 +3991,217 @@ 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 FineTuningVertical(_serialization.Model): + """FineTuningVertical. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AzureOpenAiFineTuning, CustomModelFineTuning + + All required parameters must be populated in order to send to server. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar model_provider: [Required] Enum to determine the type of fine tuning. Required. Known + values are: "AzureOpenAI" and "Custom". + :vartype model_provider: str or ~azure.mgmt.machinelearningservices.models.ModelProvider + :ivar task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :ivar training_data: [Required] Training data for fine tuning. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar validation_data: Validation data for fine tuning. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + """ + + _validation = { + "model": {"required": True}, + "model_provider": {"required": True}, + "task_type": {"required": True}, + "training_data": {"required": True}, + } + + _attribute_map = { + "model": {"key": "model", "type": "JobInput"}, + "model_provider": {"key": "modelProvider", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "JobInput"}, + "validation_data": {"key": "validationData", "type": "JobInput"}, + } + + _subtype_map = {"model_provider": {"AzureOpenAI": "AzureOpenAiFineTuning", "Custom": "CustomModelFineTuning"}} + + def __init__( + self, + *, + model: "_models.JobInput", + task_type: Union[str, "_models.FineTuningTaskType"], + training_data: "_models.JobInput", + validation_data: Optional["_models.JobInput"] = None, + **kwargs: Any + ) -> None: + """ + :keyword model: [Required] Input model for fine tuning. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :keyword training_data: [Required] Training data for fine tuning. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword validation_data: Validation data for fine tuning. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + """ + super().__init__(**kwargs) + self.model = model + self.model_provider: Optional[str] = None + self.task_type = task_type + self.training_data = training_data + self.validation_data = validation_data + + +class AzureOpenAiFineTuning(FineTuningVertical): + """AzureOpenAiFineTuning. + + All required parameters must be populated in order to send to server. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar model_provider: [Required] Enum to determine the type of fine tuning. Required. Known + values are: "AzureOpenAI" and "Custom". + :vartype model_provider: str or ~azure.mgmt.machinelearningservices.models.ModelProvider + :ivar task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :ivar training_data: [Required] Training data for fine tuning. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar validation_data: Validation data for fine tuning. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar hyper_parameters: HyperParameters for fine tuning Azure Open AI model. + :vartype hyper_parameters: + ~azure.mgmt.machinelearningservices.models.AzureOpenAiHyperParameters + """ + + _validation = { + "model": {"required": True}, + "model_provider": {"required": True}, + "task_type": {"required": True}, + "training_data": {"required": True}, + } + + _attribute_map = { + "model": {"key": "model", "type": "JobInput"}, + "model_provider": {"key": "modelProvider", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "JobInput"}, + "validation_data": {"key": "validationData", "type": "JobInput"}, + "hyper_parameters": {"key": "hyperParameters", "type": "AzureOpenAiHyperParameters"}, + } + + def __init__( + self, + *, + model: "_models.JobInput", + task_type: Union[str, "_models.FineTuningTaskType"], + training_data: "_models.JobInput", + validation_data: Optional["_models.JobInput"] = None, + hyper_parameters: Optional["_models.AzureOpenAiHyperParameters"] = None, + **kwargs: Any + ) -> None: + """ + :keyword model: [Required] Input model for fine tuning. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :keyword training_data: [Required] Training data for fine tuning. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword validation_data: Validation data for fine tuning. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword hyper_parameters: HyperParameters for fine tuning Azure Open AI model. + :paramtype hyper_parameters: + ~azure.mgmt.machinelearningservices.models.AzureOpenAiHyperParameters + """ + super().__init__( + model=model, task_type=task_type, training_data=training_data, validation_data=validation_data, **kwargs + ) + self.model_provider: str = "AzureOpenAI" + self.hyper_parameters = hyper_parameters + + +class AzureOpenAiHyperParameters(_serialization.Model): + """Azure Open AI hyperparameters for fine tuning. + + :ivar batch_size: Number of examples in each batch. A larger batch size means that model + parameters are updated less frequently, but with lower variance. + :vartype batch_size: int + :ivar learning_rate_multiplier: Scaling factor for the learning rate. A smaller learning rate + may be useful to avoid over fitting. + :vartype learning_rate_multiplier: float + :ivar n_epochs: The number of epochs to train the model for. An epoch refers to one full cycle + through the training dataset. + :vartype n_epochs: int + """ + + _attribute_map = { + "batch_size": {"key": "batchSize", "type": "int"}, + "learning_rate_multiplier": {"key": "learningRateMultiplier", "type": "float"}, + "n_epochs": {"key": "nEpochs", "type": "int"}, + } + + def __init__( + self, + *, + batch_size: Optional[int] = None, + learning_rate_multiplier: Optional[float] = None, + n_epochs: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword batch_size: Number of examples in each batch. A larger batch size means that model + parameters are updated less frequently, but with lower variance. + :paramtype batch_size: int + :keyword learning_rate_multiplier: Scaling factor for the learning rate. A smaller learning + rate may be useful to avoid over fitting. + :paramtype learning_rate_multiplier: float + :keyword n_epochs: The number of epochs to train the model for. An epoch refers to one full + cycle through the training dataset. + :paramtype n_epochs: int + """ + super().__init__(**kwargs) + self.batch_size = batch_size + self.learning_rate_multiplier = learning_rate_multiplier + self.n_epochs = n_epochs class EarlyTerminationPolicy(_serialization.Model): @@ -2822,7 +4210,7 @@ class EarlyTerminationPolicy(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: BanditPolicy, MedianStoppingPolicy, TruncationSelectionPolicy - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. :vartype delay_evaluation: int @@ -2869,7 +4257,7 @@ class BanditPolicy(EarlyTerminationPolicy): """Defines an early termination policy based on slack criteria, and a frequency and delay interval for evaluation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. :vartype delay_evaluation: int @@ -2928,7 +4316,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2969,10 +4357,10 @@ class TrackedResource(Resource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3022,10 +4410,10 @@ class BatchDeployment(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3105,6 +4493,38 @@ def __init__( self.sku = sku +class BatchDeploymentConfiguration(_serialization.Model): + """Properties relevant to different deployment types. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + BatchPipelineComponentDeploymentConfiguration + + All required parameters must be populated in order to send to server. + + :ivar deployment_configuration_type: [Required] The type of the deployment. Required. Known + values are: "Model" and "PipelineComponent". + :vartype deployment_configuration_type: str or + ~azure.mgmt.machinelearningservices.models.BatchDeploymentConfigurationType + """ + + _validation = { + "deployment_configuration_type": {"required": True}, + } + + _attribute_map = { + "deployment_configuration_type": {"key": "deploymentConfigurationType", "type": "str"}, + } + + _subtype_map = { + "deployment_configuration_type": {"PipelineComponent": "BatchPipelineComponentDeploymentConfiguration"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.deployment_configuration_type: Optional[str] = None + + class EndpointDeploymentPropertiesBase(_serialization.Model): """Base definition for endpoint deployment. @@ -3178,6 +4598,9 @@ class BatchDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: di :vartype properties: dict[str, str] :ivar compute: Compute target for batch inference operation. :vartype compute: str + :ivar deployment_configuration: Properties relevant to different deployment types. + :vartype deployment_configuration: + ~azure.mgmt.machinelearningservices.models.BatchDeploymentConfiguration :ivar error_threshold: Error threshold, if the error count for the entire input goes above this value, the batch inference will be aborted. Range is [-1, int.MaxValue]. @@ -3224,6 +4647,7 @@ class BatchDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: di "environment_variables": {"key": "environmentVariables", "type": "{str}"}, "properties": {"key": "properties", "type": "{str}"}, "compute": {"key": "compute", "type": "str"}, + "deployment_configuration": {"key": "deploymentConfiguration", "type": "BatchDeploymentConfiguration"}, "error_threshold": {"key": "errorThreshold", "type": "int"}, "logging_level": {"key": "loggingLevel", "type": "str"}, "max_concurrency_per_instance": {"key": "maxConcurrencyPerInstance", "type": "int"}, @@ -3245,6 +4669,7 @@ def __init__( environment_variables: Optional[Dict[str, str]] = None, properties: Optional[Dict[str, str]] = None, compute: Optional[str] = None, + deployment_configuration: Optional["_models.BatchDeploymentConfiguration"] = None, error_threshold: int = -1, logging_level: Optional[Union[str, "_models.BatchLoggingLevel"]] = None, max_concurrency_per_instance: int = 1, @@ -3270,6 +4695,9 @@ def __init__( :paramtype properties: dict[str, str] :keyword compute: Compute target for batch inference operation. :paramtype compute: str + :keyword deployment_configuration: Properties relevant to different deployment types. + :paramtype deployment_configuration: + ~azure.mgmt.machinelearningservices.models.BatchDeploymentConfiguration :keyword error_threshold: Error threshold, if the error count for the entire input goes above this value, the batch inference will be aborted. Range is [-1, int.MaxValue]. @@ -3310,6 +4738,7 @@ def __init__( **kwargs ) self.compute = compute + self.deployment_configuration = deployment_configuration self.error_threshold = error_threshold self.logging_level = logging_level self.max_concurrency_per_instance = max_concurrency_per_instance @@ -3322,7 +4751,7 @@ def __init__( self.retry_settings = retry_settings -class BatchDeploymentTrackedResourceArmPaginatedResult(_serialization.Model): +class BatchDeploymentTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long """A paginated list of BatchDeployment entities. :ivar next_link: The link to the next page of BatchDeployment objects. If null, there are no @@ -3357,10 +4786,10 @@ class BatchEndpoint(TrackedResource): 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3467,7 +4896,7 @@ class EndpointPropertiesBase(_serialization.Model): 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. + All required parameters must be populated in order to send to server. :ivar auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. @@ -3539,7 +4968,7 @@ class BatchEndpointProperties(EndpointPropertiesBase): 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. + All required parameters must be populated in order to send to server. :ivar auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. @@ -3614,7 +5043,7 @@ def __init__( self.provisioning_state = None -class BatchEndpointTrackedResourceArmPaginatedResult(_serialization.Model): +class BatchEndpointTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long """A paginated list of BatchEndpoint entities. :ivar next_link: The link to the next page of BatchEndpoint objects. If null, there are no @@ -3644,26 +5073,84 @@ def __init__( self.value = value -class BatchRetrySettings(_serialization.Model): - """Retry settings for a batch inference operation. +class BatchPipelineComponentDeploymentConfiguration(BatchDeploymentConfiguration): # pylint: disable=name-too-long + """Properties for a Batch Pipeline Component Deployment. - :ivar max_retries: Maximum retry count for a mini-batch. - :vartype max_retries: int - :ivar timeout: Invocation timeout for a mini-batch, in ISO 8601 format. - :vartype timeout: ~datetime.timedelta + All required parameters must be populated in order to send to server. + + :ivar deployment_configuration_type: [Required] The type of the deployment. Required. Known + values are: "Model" and "PipelineComponent". + :vartype deployment_configuration_type: str or + ~azure.mgmt.machinelearningservices.models.BatchDeploymentConfigurationType + :ivar component_id: The ARM id of the component to be run. + :vartype component_id: ~azure.mgmt.machinelearningservices.models.IdAssetReference + :ivar description: The description which will be applied to the job. + :vartype description: str + :ivar settings: Run-time settings for the pipeline job. + :vartype settings: dict[str, str] + :ivar tags: The tags which will be applied to the job. + :vartype tags: dict[str, str] """ + _validation = { + "deployment_configuration_type": {"required": True}, + } + _attribute_map = { - "max_retries": {"key": "maxRetries", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "deployment_configuration_type": {"key": "deploymentConfigurationType", "type": "str"}, + "component_id": {"key": "componentId", "type": "IdAssetReference"}, + "description": {"key": "description", "type": "str"}, + "settings": {"key": "settings", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, max_retries: int = 3, timeout: datetime.timedelta = "PT30S", **kwargs: Any) -> None: - """ - :keyword max_retries: Maximum retry count for a mini-batch. - :paramtype max_retries: int - :keyword timeout: Invocation timeout for a mini-batch, in ISO 8601 format. - :paramtype timeout: ~datetime.timedelta + def __init__( + self, + *, + component_id: Optional["_models.IdAssetReference"] = None, + description: Optional[str] = None, + settings: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword component_id: The ARM id of the component to be run. + :paramtype component_id: ~azure.mgmt.machinelearningservices.models.IdAssetReference + :keyword description: The description which will be applied to the job. + :paramtype description: str + :keyword settings: Run-time settings for the pipeline job. + :paramtype settings: dict[str, str] + :keyword tags: The tags which will be applied to the job. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.deployment_configuration_type: str = "PipelineComponent" + self.component_id = component_id + self.description = description + self.settings = settings + self.tags = tags + + +class BatchRetrySettings(_serialization.Model): + """Retry settings for a batch inference operation. + + :ivar max_retries: Maximum retry count for a mini-batch. + :vartype max_retries: int + :ivar timeout: Invocation timeout for a mini-batch, in ISO 8601 format. + :vartype timeout: ~datetime.timedelta + """ + + _attribute_map = { + "max_retries": {"key": "maxRetries", "type": "int"}, + "timeout": {"key": "timeout", "type": "duration"}, + } + + def __init__(self, *, max_retries: int = 3, timeout: datetime.timedelta = "PT30S", **kwargs: Any) -> None: + """ + :keyword max_retries: Maximum retry count for a mini-batch. + :paramtype max_retries: int + :keyword timeout: Invocation timeout for a mini-batch, in ISO 8601 format. + :paramtype timeout: ~datetime.timedelta """ super().__init__(**kwargs) self.max_retries = max_retries @@ -3677,7 +5164,7 @@ class SamplingAlgorithm(_serialization.Model): You probably want to use the sub-classes and not this class directly. Known sub-classes are: BayesianSamplingAlgorithm, GridSamplingAlgorithm, RandomSamplingAlgorithm - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter values, along with configuration properties. Required. Known values are: "Grid", "Random", and @@ -3711,7 +5198,7 @@ def __init__(self, **kwargs: Any) -> None: class BayesianSamplingAlgorithm(SamplingAlgorithm): """Defines a Sampling Algorithm that generates values based on previous values. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter values, along with configuration properties. Required. Known values are: "Grid", "Random", and @@ -3735,7 +5222,7 @@ def __init__(self, **kwargs: Any) -> None: class BindOptions(_serialization.Model): - """Describes the bind options for the container. + """BindOptions. :ivar propagation: Type of Bind Option. :vartype propagation: str @@ -3817,7 +5304,7 @@ def __init__( class BuildContext(_serialization.Model): """Configuration settings for Docker build context. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar context_uri: [Required] URI of the Docker build context used to build the image. Supports blob URIs on environment creation and may return blob or Git URIs. @@ -3872,1205 +5359,1103 @@ def __init__(self, *, context_uri: str, dockerfile_path: str = "Dockerfile", **k self.dockerfile_path = dockerfile_path -class CertificateDatastoreCredentials(DatastoreCredentials): - """Certificate datastore credentials configuration. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". - :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType - :ivar authority_url: Authority URL used for authentication. - :vartype authority_url: str - :ivar client_id: [Required] Service principal client ID. Required. - :vartype client_id: str - :ivar resource_url: Resource the service principal has access to. - :vartype resource_url: str - :ivar secrets: [Required] Service principal secrets. Required. - :vartype secrets: ~azure.mgmt.machinelearningservices.models.CertificateDatastoreSecrets - :ivar tenant_id: [Required] ID of the tenant to which the service principal belongs. Required. - :vartype tenant_id: str - :ivar thumbprint: [Required] Thumbprint of the certificate used for authentication. Required. - :vartype thumbprint: str + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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 + """ + + +class CapabilityHost(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.CapabilityHostProperties """ _validation = { - "credentials_type": {"required": True}, - "client_id": {"required": True}, - "secrets": {"required": True}, - "tenant_id": {"required": True}, - "thumbprint": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "credentials_type": {"key": "credentialsType", "type": "str"}, - "authority_url": {"key": "authorityUrl", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - "resource_url": {"key": "resourceUrl", "type": "str"}, - "secrets": {"key": "secrets", "type": "CertificateDatastoreSecrets"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "thumbprint": {"key": "thumbprint", "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": "CapabilityHostProperties"}, } - def __init__( - self, - *, - client_id: str, - secrets: "_models.CertificateDatastoreSecrets", - tenant_id: str, - thumbprint: str, - authority_url: Optional[str] = None, - resource_url: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.CapabilityHostProperties", **kwargs: Any) -> None: """ - :keyword authority_url: Authority URL used for authentication. - :paramtype authority_url: str - :keyword client_id: [Required] Service principal client ID. Required. - :paramtype client_id: str - :keyword resource_url: Resource the service principal has access to. - :paramtype resource_url: str - :keyword secrets: [Required] Service principal secrets. Required. - :paramtype secrets: ~azure.mgmt.machinelearningservices.models.CertificateDatastoreSecrets - :keyword tenant_id: [Required] ID of the tenant to which the service principal belongs. - Required. - :paramtype tenant_id: str - :keyword thumbprint: [Required] Thumbprint of the certificate used for authentication. - Required. - :paramtype thumbprint: str + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.CapabilityHostProperties """ super().__init__(**kwargs) - self.credentials_type: str = "Certificate" - self.authority_url = authority_url - self.client_id = client_id - self.resource_url = resource_url - self.secrets = secrets - self.tenant_id = tenant_id - self.thumbprint = thumbprint + self.properties = properties -class CertificateDatastoreSecrets(DatastoreSecrets): - """Datastore certificate secrets. +class CapabilityHostProperties(ResourceBase): + """CapabilityHostProperties. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". - :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType - :ivar certificate: Service principal certificate. - :vartype certificate: str + :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 ai_services_connections: List of AI services connections. + :vartype ai_services_connections: list[str] + :ivar capability_host_kind: Kind of this capability host. "Agents" + :vartype capability_host_kind: str or + ~azure.mgmt.machinelearningservices.models.CapabilityHostKind + :ivar customer_subnet: Customer subnet info to help set up this capability host. + :vartype customer_subnet: str + :ivar provisioning_state: Provisioning state for the CapabilityHost. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.CapabilityHostProvisioningState + :ivar storage_connections: List of Storage connections. + :vartype storage_connections: list[str] + :ivar vector_store_connections: List of VectorStore connections. + :vartype vector_store_connections: list[str] """ _validation = { - "secrets_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "secrets_type": {"key": "secretsType", "type": "str"}, - "certificate": {"key": "certificate", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "ai_services_connections": {"key": "aiServicesConnections", "type": "[str]"}, + "capability_host_kind": {"key": "capabilityHostKind", "type": "str"}, + "customer_subnet": {"key": "customerSubnet", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "storage_connections": {"key": "storageConnections", "type": "[str]"}, + "vector_store_connections": {"key": "vectorStoreConnections", "type": "[str]"}, } - def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + ai_services_connections: Optional[List[str]] = None, + capability_host_kind: Optional[Union[str, "_models.CapabilityHostKind"]] = None, + customer_subnet: Optional[str] = None, + storage_connections: Optional[List[str]] = None, + vector_store_connections: Optional[List[str]] = None, + **kwargs: Any + ) -> None: """ - :keyword certificate: Service principal certificate. - :paramtype certificate: str + :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 ai_services_connections: List of AI services connections. + :paramtype ai_services_connections: list[str] + :keyword capability_host_kind: Kind of this capability host. "Agents" + :paramtype capability_host_kind: str or + ~azure.mgmt.machinelearningservices.models.CapabilityHostKind + :keyword customer_subnet: Customer subnet info to help set up this capability host. + :paramtype customer_subnet: str + :keyword storage_connections: List of Storage connections. + :paramtype storage_connections: list[str] + :keyword vector_store_connections: List of VectorStore connections. + :paramtype vector_store_connections: list[str] """ - super().__init__(**kwargs) - self.secrets_type: str = "Certificate" - self.certificate = certificate + super().__init__(description=description, properties=properties, tags=tags, **kwargs) + self.ai_services_connections = ai_services_connections + self.capability_host_kind = capability_host_kind + self.customer_subnet = customer_subnet + self.provisioning_state = None + self.storage_connections = storage_connections + self.vector_store_connections = vector_store_connections -class TableVertical(_serialization.Model): - """Abstract class for AutoML tasks that use table dataset as input - such as - Classification/Regression/Forecasting. +class CapacityConfig(_serialization.Model): + """The capacity configuration. - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :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 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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype test_data_size: float - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :vartype weight_column_name: str + :ivar minimum: The minimum capacity. + :vartype minimum: int + :ivar maximum: The maximum capacity. + :vartype maximum: int + :ivar step: The minimal incremental between allowed values for capacity. + :vartype step: int + :ivar default: The default capacity. + :vartype default: int + :ivar allowed_values: The array of allowed values for capacity. + :vartype allowed_values: list[int] """ _attribute_map = { - "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, - "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, - "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, - "test_data": {"key": "testData", "type": "MLTableJobInput"}, - "test_data_size": {"key": "testDataSize", "type": "float"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "weight_column_name": {"key": "weightColumnName", "type": "str"}, + "minimum": {"key": "minimum", "type": "int"}, + "maximum": {"key": "maximum", "type": "int"}, + "step": {"key": "step", "type": "int"}, + "default": {"key": "default", "type": "int"}, + "allowed_values": {"key": "allowedValues", "type": "[int]"}, } def __init__( self, *, - cv_split_column_names: Optional[List[str]] = None, - featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, - n_cross_validations: Optional["_models.NCrossValidations"] = None, - test_data: Optional["_models.MLTableJobInput"] = None, - test_data_size: Optional[float] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - weight_column_name: Optional[str] = None, + minimum: Optional[int] = None, + maximum: Optional[int] = None, + step: Optional[int] = None, + default: Optional[int] = None, + allowed_values: Optional[List[int]] = None, **kwargs: Any ) -> None: """ - :keyword cv_split_column_names: Columns to use for CVSplit data. - :paramtype cv_split_column_names: list[str] - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :keyword n_cross_validations: Number of cross validation folds to be applied on training - dataset - when validation dataset is not provided. - :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype test_data_size: float - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :paramtype weight_column_name: str + :keyword minimum: The minimum capacity. + :paramtype minimum: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int + :keyword step: The minimal incremental between allowed values for capacity. + :paramtype step: int + :keyword default: The default capacity. + :paramtype default: int + :keyword allowed_values: The array of allowed values for capacity. + :paramtype allowed_values: list[int] """ super().__init__(**kwargs) - self.cv_split_column_names = cv_split_column_names - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.n_cross_validations = n_cross_validations - self.test_data = test_data - self.test_data_size = test_data_size - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.weight_column_name = weight_column_name + self.minimum = minimum + self.maximum = maximum + self.step = step + self.default = default + self.allowed_values = allowed_values -class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Classification task in AutoML Table vertical. +class DataDriftMetricThresholdBase(_serialization.Model): + """DataDriftMetricThresholdBase. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CategoricalDataDriftMetricThreshold, NumericalDataDriftMetricThreshold - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :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 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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype test_data_size: float - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :vartype weight_column_name: str - :ivar positive_label: Positive label for binary metrics calculation. - :vartype positive_label: str - :ivar primary_metric: Primary metric for the task. Known values are: "AUCWeighted", "Accuracy", - "NormMacroRecall", "AveragePrecisionScoreWeighted", and "PrecisionScoreWeighted". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics - :ivar training_settings: Inputs for training phase for an AutoML Job. - :vartype training_settings: - ~azure.mgmt.machinelearningservices.models.ClassificationTrainingSettings + All required parameters must be populated in order to send to server. + + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, + "data_type": {"required": True}, } _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, - "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, - "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, - "test_data": {"key": "testData", "type": "MLTableJobInput"}, - "test_data_size": {"key": "testDataSize", "type": "float"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "weight_column_name": {"key": "weightColumnName", "type": "str"}, - "positive_label": {"key": "positiveLabel", "type": "str"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, - "training_settings": {"key": "trainingSettings", "type": "ClassificationTrainingSettings"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } - def __init__( - self, - *, - training_data: "_models.MLTableJobInput", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - cv_split_column_names: Optional[List[str]] = None, - featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, - n_cross_validations: Optional["_models.NCrossValidations"] = None, - test_data: Optional["_models.MLTableJobInput"] = None, - test_data_size: Optional[float] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - weight_column_name: Optional[str] = None, - positive_label: Optional[str] = None, - primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, - training_settings: Optional["_models.ClassificationTrainingSettings"] = None, - **kwargs: Any - ) -> None: + _subtype_map = { + "data_type": { + "Categorical": "CategoricalDataDriftMetricThreshold", + "Numerical": "NumericalDataDriftMetricThreshold", + } + } + + def __init__(self, *, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword cv_split_column_names: Columns to use for CVSplit data. - :paramtype cv_split_column_names: list[str] - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :keyword n_cross_validations: Number of cross validation folds to be applied on training - dataset - when validation dataset is not provided. - :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype test_data_size: float - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :paramtype weight_column_name: str - :keyword positive_label: Positive label for binary metrics calculation. - :paramtype positive_label: str - :keyword primary_metric: Primary metric for the task. Known values are: "AUCWeighted", - "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and "PrecisionScoreWeighted". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics - :keyword training_settings: Inputs for training phase for an AutoML Job. - :paramtype training_settings: - ~azure.mgmt.machinelearningservices.models.ClassificationTrainingSettings + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ - super().__init__( - cv_split_column_names=cv_split_column_names, - featurization_settings=featurization_settings, - limit_settings=limit_settings, - n_cross_validations=n_cross_validations, - test_data=test_data, - test_data_size=test_data_size, - validation_data=validation_data, - validation_data_size=validation_data_size, - weight_column_name=weight_column_name, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "Classification" - self.training_data = training_data - self.positive_label = positive_label - self.primary_metric = primary_metric - self.training_settings = training_settings - self.cv_split_column_names = cv_split_column_names - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.n_cross_validations = n_cross_validations - self.test_data = test_data - self.test_data_size = test_data_size - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.weight_column_name = weight_column_name + super().__init__(**kwargs) + self.data_type: Optional[str] = None + self.threshold = threshold -class TrainingSettings(_serialization.Model): - """Training related configuration. +class CategoricalDataDriftMetricThreshold(DataDriftMetricThresholdBase): + """CategoricalDataDriftMetricThreshold. - :ivar enable_dnn_training: Enable recommendation of DNN models. - :vartype enable_dnn_training: bool - :ivar enable_model_explainability: Flag to turn on explainability on best model. - :vartype enable_model_explainability: bool - :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :vartype enable_onnx_compatible_models: bool - :ivar enable_stack_ensemble: Enable stack ensemble run. - :vartype enable_stack_ensemble: bool - :ivar enable_vote_ensemble: Enable voting ensemble run. - :vartype enable_vote_ensemble: bool - :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :vartype ensemble_model_download_timeout: ~datetime.timedelta - :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :vartype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + All required parameters must be populated in order to send to server. + + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The categorical data drift metric to calculate. Required. Known values + are: "JensenShannonDistance", "PopulationStabilityIndex", and "PearsonsChiSquaredTest". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.CategoricalDataDriftMetric """ + _validation = { + "data_type": {"required": True}, + "metric": {"required": True}, + } + _attribute_map = { - "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, - "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, - "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, - "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, - "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, - "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, - "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } def __init__( self, *, - enable_dnn_training: bool = False, - enable_model_explainability: bool = True, - enable_onnx_compatible_models: bool = False, - enable_stack_ensemble: bool = True, - enable_vote_ensemble: bool = True, - ensemble_model_download_timeout: datetime.timedelta = "PT5M", - stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + metric: Union[str, "_models.CategoricalDataDriftMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any ) -> None: """ - :keyword enable_dnn_training: Enable recommendation of DNN models. - :paramtype enable_dnn_training: bool - :keyword enable_model_explainability: Flag to turn on explainability on best model. - :paramtype enable_model_explainability: bool - :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :paramtype enable_onnx_compatible_models: bool - :keyword enable_stack_ensemble: Enable stack ensemble run. - :paramtype enable_stack_ensemble: bool - :keyword enable_vote_ensemble: Enable voting ensemble run. - :paramtype enable_vote_ensemble: bool - :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :paramtype ensemble_model_download_timeout: ~datetime.timedelta - :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :paramtype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The categorical data drift metric to calculate. Required. Known + values are: "JensenShannonDistance", "PopulationStabilityIndex", and "PearsonsChiSquaredTest". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.CategoricalDataDriftMetric """ - super().__init__(**kwargs) - self.enable_dnn_training = enable_dnn_training - self.enable_model_explainability = enable_model_explainability - self.enable_onnx_compatible_models = enable_onnx_compatible_models - self.enable_stack_ensemble = enable_stack_ensemble - self.enable_vote_ensemble = enable_vote_ensemble - self.ensemble_model_download_timeout = ensemble_model_download_timeout - self.stack_ensemble_settings = stack_ensemble_settings - - -class ClassificationTrainingSettings(TrainingSettings): - """Classification Training related configuration. - - :ivar enable_dnn_training: Enable recommendation of DNN models. - :vartype enable_dnn_training: bool - :ivar enable_model_explainability: Flag to turn on explainability on best model. - :vartype enable_model_explainability: bool - :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :vartype enable_onnx_compatible_models: bool - :ivar enable_stack_ensemble: Enable stack ensemble run. - :vartype enable_stack_ensemble: bool - :ivar enable_vote_ensemble: Enable voting ensemble run. - :vartype enable_vote_ensemble: bool - :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :vartype ensemble_model_download_timeout: ~datetime.timedelta - :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :vartype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :ivar allowed_training_algorithms: Allowed models for classification task. - :vartype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ClassificationModels] - :ivar blocked_training_algorithms: Blocked models for classification task. - :vartype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ClassificationModels] - """ + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Categorical" + self.metric = metric - _attribute_map = { - "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, - "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, - "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, - "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, - "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, - "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, - "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, - "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, - "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, - } - def __init__( - self, - *, - enable_dnn_training: bool = False, - enable_model_explainability: bool = True, - enable_onnx_compatible_models: bool = False, - enable_stack_ensemble: bool = True, - enable_vote_ensemble: bool = True, - ensemble_model_download_timeout: datetime.timedelta = "PT5M", - stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, - allowed_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, - blocked_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_dnn_training: Enable recommendation of DNN models. - :paramtype enable_dnn_training: bool - :keyword enable_model_explainability: Flag to turn on explainability on best model. - :paramtype enable_model_explainability: bool - :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :paramtype enable_onnx_compatible_models: bool - :keyword enable_stack_ensemble: Enable stack ensemble run. - :paramtype enable_stack_ensemble: bool - :keyword enable_vote_ensemble: Enable voting ensemble run. - :paramtype enable_vote_ensemble: bool - :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :paramtype ensemble_model_download_timeout: ~datetime.timedelta - :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :paramtype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :keyword allowed_training_algorithms: Allowed models for classification task. - :paramtype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ClassificationModels] - :keyword blocked_training_algorithms: Blocked models for classification task. - :paramtype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ClassificationModels] - """ - super().__init__( - enable_dnn_training=enable_dnn_training, - enable_model_explainability=enable_model_explainability, - enable_onnx_compatible_models=enable_onnx_compatible_models, - enable_stack_ensemble=enable_stack_ensemble, - enable_vote_ensemble=enable_vote_ensemble, - ensemble_model_download_timeout=ensemble_model_download_timeout, - stack_ensemble_settings=stack_ensemble_settings, - **kwargs - ) - self.allowed_training_algorithms = allowed_training_algorithms - self.blocked_training_algorithms = blocked_training_algorithms +class DataQualityMetricThresholdBase(_serialization.Model): + """DataQualityMetricThresholdBase. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CategoricalDataQualityMetricThreshold, NumericalDataQualityMetricThreshold -class ClusterUpdateParameters(_serialization.Model): - """AmlCompute update parameters. + All required parameters must be populated in order to send to server. - :ivar properties: Properties of ClusterUpdate. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ + _validation = { + "data_type": {"required": True}, + } + _attribute_map = { - "properties": {"key": "properties.properties", "type": "ScaleSettingsInformation"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } - def __init__(self, *, properties: Optional["_models.ScaleSettingsInformation"] = None, **kwargs: Any) -> None: + _subtype_map = { + "data_type": { + "Categorical": "CategoricalDataQualityMetricThreshold", + "Numerical": "NumericalDataQualityMetricThreshold", + } + } + + def __init__(self, *, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any) -> None: """ - :keyword properties: Properties of ClusterUpdate. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ super().__init__(**kwargs) - self.properties = properties + self.data_type: Optional[str] = None + self.threshold = threshold -class CodeConfiguration(_serialization.Model): - """Configuration for a scoring code asset. +class CategoricalDataQualityMetricThreshold(DataQualityMetricThresholdBase): + """CategoricalDataQualityMetricThreshold. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar code_id: ARM resource ID of the code asset. - :vartype code_id: str - :ivar scoring_script: [Required] The script to execute on startup. eg. "score.py". Required. - :vartype scoring_script: str + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The categorical data quality metric to calculate. Required. Known + values are: "NullValueRate", "DataTypeErrorRate", and "OutOfBoundsRate". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.CategoricalDataQualityMetric """ _validation = { - "scoring_script": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "data_type": {"required": True}, + "metric": {"required": True}, } _attribute_map = { - "code_id": {"key": "codeId", "type": "str"}, - "scoring_script": {"key": "scoringScript", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } - def __init__(self, *, scoring_script: str, code_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + metric: Union[str, "_models.CategoricalDataQualityMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any + ) -> None: """ - :keyword code_id: ARM resource ID of the code asset. - :paramtype code_id: str - :keyword scoring_script: [Required] The script to execute on startup. eg. "score.py". Required. - :paramtype scoring_script: str + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The categorical data quality metric to calculate. Required. Known + values are: "NullValueRate", "DataTypeErrorRate", and "OutOfBoundsRate". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.CategoricalDataQualityMetric """ - super().__init__(**kwargs) - self.code_id = code_id - self.scoring_script = scoring_script + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Categorical" + self.metric = metric -class CodeContainer(Resource): - """Azure Resource Manager resource envelope. +class PredictionDriftMetricThresholdBase(_serialization.Model): + """PredictionDriftMetricThresholdBase. - 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: + CategoricalPredictionDriftMetricThreshold, NumericalPredictionDriftMetricThreshold - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :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.CodeContainerProperties + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "data_type": {"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"}, - "properties": {"key": "properties", "type": "CodeContainerProperties"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } - def __init__(self, *, properties: "_models.CodeContainerProperties", **kwargs: Any) -> None: + _subtype_map = { + "data_type": { + "Categorical": "CategoricalPredictionDriftMetricThreshold", + "Numerical": "NumericalPredictionDriftMetricThreshold", + } + } + + def __init__(self, *, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeContainerProperties + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ super().__init__(**kwargs) - self.properties = properties + self.data_type: Optional[str] = None + self.threshold = threshold -class CodeContainerProperties(AssetContainer): - """Container for code asset versions. +class CategoricalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): # pylint: disable=name-too-long + """CategoricalPredictionDriftMetricThreshold. - 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 server. - :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 is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :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 + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The categorical prediction drift metric to calculate. Required. Known + values are: "JensenShannonDistance", "PopulationStabilityIndex", and "PearsonsChiSquaredTest". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.CategoricalPredictionDriftMetric """ _validation = { - "latest_version": {"readonly": True}, - "next_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "data_type": {"required": True}, + "metric": {"required": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "latest_version": {"key": "latestVersion", "type": "str"}, - "next_version": {"key": "nextVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: bool = False, + metric: Union[str, "_models.CategoricalPredictionDriftMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any ) -> None: """ - :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 is_archived: Is the asset archived?. - :paramtype is_archived: bool + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The categorical prediction drift metric to calculate. Required. + Known values are: "JensenShannonDistance", "PopulationStabilityIndex", and + "PearsonsChiSquaredTest". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.CategoricalPredictionDriftMetric """ - super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Categorical" + self.metric = metric -class CodeContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of CodeContainer entities. +class CertificateDatastoreCredentials(DatastoreCredentials): + """Certificate datastore credentials configuration. - :ivar next_link: The link to the next page of CodeContainer objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type CodeContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] + All required parameters must be populated in order to send to server. + + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar authority_url: Authority URL used for authentication. + :vartype authority_url: str + :ivar client_id: [Required] Service principal client ID. Required. + :vartype client_id: str + :ivar resource_url: Resource the service principal has access to. + :vartype resource_url: str + :ivar secrets: [Required] Service principal secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.CertificateDatastoreSecrets + :ivar tenant_id: [Required] ID of the tenant to which the service principal belongs. Required. + :vartype tenant_id: str + :ivar thumbprint: [Required] Thumbprint of the certificate used for authentication. Required. + :vartype thumbprint: str """ - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CodeContainer]"}, + _validation = { + "credentials_type": {"required": True}, + "client_id": {"required": True}, + "secrets": {"required": True}, + "tenant_id": {"required": True}, + "thumbprint": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "credentials_type": {"key": "credentialsType", "type": "str"}, + "authority_url": {"key": "authorityUrl", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "resource_url": {"key": "resourceUrl", "type": "str"}, + "secrets": {"key": "secrets", "type": "CertificateDatastoreSecrets"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "thumbprint": {"key": "thumbprint", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.CodeContainer"]] = None, **kwargs: Any + self, + *, + client_id: str, + secrets: "_models.CertificateDatastoreSecrets", + tenant_id: str, + thumbprint: str, + authority_url: Optional[str] = None, + resource_url: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of CodeContainer objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type CodeContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] + :keyword authority_url: Authority URL used for authentication. + :paramtype authority_url: str + :keyword client_id: [Required] Service principal client ID. Required. + :paramtype client_id: str + :keyword resource_url: Resource the service principal has access to. + :paramtype resource_url: str + :keyword secrets: [Required] Service principal secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.CertificateDatastoreSecrets + :keyword tenant_id: [Required] ID of the tenant to which the service principal belongs. + Required. + :paramtype tenant_id: str + :keyword thumbprint: [Required] Thumbprint of the certificate used for authentication. + Required. + :paramtype thumbprint: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value - + self.credentials_type: str = "Certificate" + self.authority_url = authority_url + self.client_id = client_id + self.resource_url = resource_url + self.secrets = secrets + self.tenant_id = tenant_id + self.thumbprint = thumbprint -class CodeVersion(Resource): - """Azure Resource Manager resource envelope. - Variables are only populated by the server, and will be ignored when sending a request. +class CertificateDatastoreSecrets(DatastoreSecrets): + """Datastore certificate secrets. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :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.CodeVersionProperties + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar certificate: Service principal certificate. + :vartype certificate: str """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "secrets_type": {"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"}, - "properties": {"key": "properties", "type": "CodeVersionProperties"}, + "secrets_type": {"key": "secretsType", "type": "str"}, + "certificate": {"key": "certificate", "type": "str"}, } - def __init__(self, *, properties: "_models.CodeVersionProperties", **kwargs: Any) -> None: + def __init__(self, *, certificate: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeVersionProperties + :keyword certificate: Service principal certificate. + :paramtype certificate: str """ super().__init__(**kwargs) - self.properties = properties - + self.secrets_type: str = "Certificate" + self.certificate = certificate -class CodeVersionProperties(AssetBase): - """Code asset version details. - Variables are only populated by the server, and will be ignored when sending a request. +class TableVertical(_serialization.Model): + """Abstract class for AutoML tasks that use table dataset as input - such as + Classification/Regression/Forecasting. - :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 is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :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 + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :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 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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype test_data_size: float + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :vartype weight_column_name: str """ - _validation = { - "provisioning_state": {"readonly": True}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_anonymous": {"key": "isAnonymous", "type": "bool"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "code_uri": {"key": "codeUri", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, + "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, + "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "weight_column_name": {"key": "weightColumnName", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: bool = False, - is_archived: bool = False, - code_uri: Optional[str] = None, + cv_split_column_names: Optional[List[str]] = None, + featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + weight_column_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :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 is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword code_uri: Uri where code is located. - :paramtype code_uri: str + :keyword cv_split_column_names: Columns to use for CVSplit data. + :paramtype cv_split_column_names: list[str] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :keyword n_cross_validations: Number of cross validation folds to be applied on training + dataset + when validation dataset is not provided. + :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype test_data_size: float + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :paramtype weight_column_name: str """ - super().__init__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, - **kwargs - ) - self.code_uri = code_uri - self.provisioning_state = None + super().__init__(**kwargs) + self.cv_split_column_names = cv_split_column_names + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name -class CodeVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of CodeVersion entities. +class Classification(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Classification task in AutoML Table vertical. - :ivar next_link: The link to the next page of CodeVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type CodeVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.CodeVersion] - """ + All required parameters must be populated in order to send to server. - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CodeVersion]"}, + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :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 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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype test_data_size: float + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :vartype weight_column_name: str + :ivar positive_label: Positive label for binary metrics calculation. + :vartype positive_label: str + :ivar primary_metric: Primary metric for the task. Known values are: "AUCWeighted", "Accuracy", + "NormMacroRecall", "AveragePrecisionScoreWeighted", and "PrecisionScoreWeighted". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :ivar training_settings: Inputs for training phase for an AutoML Job. + :vartype training_settings: + ~azure.mgmt.machinelearningservices.models.ClassificationTrainingSettings + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, + "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "weight_column_name": {"key": "weightColumnName", "type": "str"}, + "positive_label": {"key": "positiveLabel", "type": "str"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + "training_settings": {"key": "trainingSettings", "type": "ClassificationTrainingSettings"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.CodeVersion"]] = None, **kwargs: Any + self, + *, + training_data: "_models.MLTableJobInput", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + cv_split_column_names: Optional[List[str]] = None, + featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + weight_column_name: Optional[str] = None, + positive_label: Optional[str] = None, + primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, + training_settings: Optional["_models.ClassificationTrainingSettings"] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of CodeVersion objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type CodeVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.CodeVersion] + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword cv_split_column_names: Columns to use for CVSplit data. + :paramtype cv_split_column_names: list[str] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :keyword n_cross_validations: Number of cross validation folds to be applied on training + dataset + when validation dataset is not provided. + :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype test_data_size: float + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :paramtype weight_column_name: str + :keyword positive_label: Positive label for binary metrics calculation. + :paramtype positive_label: str + :keyword primary_metric: Primary metric for the task. Known values are: "AUCWeighted", + "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and "PrecisionScoreWeighted". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :keyword training_settings: Inputs for training phase for an AutoML Job. + :paramtype training_settings: + ~azure.mgmt.machinelearningservices.models.ClassificationTrainingSettings """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value + super().__init__( + cv_split_column_names=cv_split_column_names, + featurization_settings=featurization_settings, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + validation_data_size=validation_data_size, + weight_column_name=weight_column_name, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "Classification" + self.training_data = training_data + self.positive_label = positive_label + self.primary_metric = primary_metric + self.training_settings = training_settings + self.cv_split_column_names = cv_split_column_names + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name -class ColumnTransformer(_serialization.Model): - """Column transformer parameters. +class TrainingSettings(_serialization.Model): + """Training related configuration. - :ivar fields: Fields to apply transformer logic on. - :vartype fields: list[str] - :ivar parameters: Different properties to be passed to transformer. - Input expected is dictionary of key,value pairs in JSON format. - :vartype parameters: JSON + :ivar enable_dnn_training: Enable recommendation of DNN models. + :vartype enable_dnn_training: bool + :ivar enable_model_explainability: Flag to turn on explainability on best model. + :vartype enable_model_explainability: bool + :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :vartype enable_onnx_compatible_models: bool + :ivar enable_stack_ensemble: Enable stack ensemble run. + :vartype enable_stack_ensemble: bool + :ivar enable_vote_ensemble: Enable voting ensemble run. + :vartype enable_vote_ensemble: bool + :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :vartype ensemble_model_download_timeout: ~datetime.timedelta + :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :vartype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings """ _attribute_map = { - "fields": {"key": "fields", "type": "[str]"}, - "parameters": {"key": "parameters", "type": "object"}, + "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, + "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, + "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, + "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, + "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, + "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, + "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, } - def __init__(self, *, fields: Optional[List[str]] = None, parameters: Optional[JSON] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + enable_dnn_training: bool = False, + enable_model_explainability: bool = True, + enable_onnx_compatible_models: bool = False, + enable_stack_ensemble: bool = True, + enable_vote_ensemble: bool = True, + ensemble_model_download_timeout: datetime.timedelta = "PT5M", + stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + **kwargs: Any + ) -> None: """ - :keyword fields: Fields to apply transformer logic on. - :paramtype fields: list[str] - :keyword parameters: Different properties to be passed to transformer. - Input expected is dictionary of key,value pairs in JSON format. - :paramtype parameters: JSON + :keyword enable_dnn_training: Enable recommendation of DNN models. + :paramtype enable_dnn_training: bool + :keyword enable_model_explainability: Flag to turn on explainability on best model. + :paramtype enable_model_explainability: bool + :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :paramtype enable_onnx_compatible_models: bool + :keyword enable_stack_ensemble: Enable stack ensemble run. + :paramtype enable_stack_ensemble: bool + :keyword enable_vote_ensemble: Enable voting ensemble run. + :paramtype enable_vote_ensemble: bool + :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :paramtype ensemble_model_download_timeout: ~datetime.timedelta + :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :paramtype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings """ super().__init__(**kwargs) - self.fields = fields - self.parameters = parameters - - -class CommandJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes - """Command job definition. - - Variables are only populated by the server, and will be ignored when sending a request. + self.enable_dnn_training = enable_dnn_training + self.enable_model_explainability = enable_model_explainability + self.enable_onnx_compatible_models = enable_onnx_compatible_models + self.enable_stack_ensemble = enable_stack_ensemble + self.enable_vote_ensemble = enable_vote_ensemble + self.ensemble_model_download_timeout = ensemble_model_download_timeout + self.stack_ensemble_settings = stack_ensemble_settings - 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", "Sweep", and "Pipeline". - :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". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus - :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". - Required. - :vartype command: str - :ivar distribution: Distribution configuration of the job. If set, this should be one of Mpi, - Tensorflow, PyTorch, or null. - :vartype distribution: ~azure.mgmt.machinelearningservices.models.DistributionConfiguration - :ivar environment_id: [Required] The ARM resource ID of the Environment specification for the - job. Required. - :vartype environment_id: str - :ivar environment_variables: Environment variables included in the job. - :vartype environment_variables: dict[str, str] - :ivar inputs: Mapping of input data bindings used in the job. - :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :ivar limits: Command Job limit. - :vartype limits: ~azure.mgmt.machinelearningservices.models.CommandJobLimits - :ivar outputs: Mapping of output data bindings used in the job. - :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :ivar parameters: Input parameters. - :vartype parameters: JSON - :ivar resources: Compute Resource configuration for the job. - :vartype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration - """ +class ClassificationTrainingSettings(TrainingSettings): + """Classification Training related configuration. - _validation = { - "job_type": {"required": True}, - "status": {"readonly": True}, - "command": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - "environment_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - "parameters": {"readonly": True}, - } + :ivar enable_dnn_training: Enable recommendation of DNN models. + :vartype enable_dnn_training: bool + :ivar enable_model_explainability: Flag to turn on explainability on best model. + :vartype enable_model_explainability: bool + :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :vartype enable_onnx_compatible_models: bool + :ivar enable_stack_ensemble: Enable stack ensemble run. + :vartype enable_stack_ensemble: bool + :ivar enable_vote_ensemble: Enable voting ensemble run. + :vartype enable_vote_ensemble: bool + :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :vartype ensemble_model_download_timeout: ~datetime.timedelta + :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :vartype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar allowed_training_algorithms: Allowed models for classification task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] + :ivar blocked_training_algorithms: Blocked models for classification task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] + """ _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"}, - "code_id": {"key": "codeId", "type": "str"}, - "command": {"key": "command", "type": "str"}, - "distribution": {"key": "distribution", "type": "DistributionConfiguration"}, - "environment_id": {"key": "environmentId", "type": "str"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "inputs": {"key": "inputs", "type": "{JobInput}"}, - "limits": {"key": "limits", "type": "CommandJobLimits"}, - "outputs": {"key": "outputs", "type": "{JobOutput}"}, - "parameters": {"key": "parameters", "type": "object"}, - "resources": {"key": "resources", "type": "JobResourceConfiguration"}, + "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, + "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, + "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, + "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, + "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, + "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, + "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, + "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } def __init__( self, *, - command: str, - environment_id: str, - 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, - code_id: Optional[str] = None, - distribution: Optional["_models.DistributionConfiguration"] = None, - environment_variables: Optional[Dict[str, str]] = None, - inputs: Optional[Dict[str, "_models.JobInput"]] = None, - limits: Optional["_models.CommandJobLimits"] = None, - outputs: Optional[Dict[str, "_models.JobOutput"]] = None, - resources: Optional["_models.JobResourceConfiguration"] = None, + enable_dnn_training: bool = False, + enable_model_explainability: bool = True, + enable_onnx_compatible_models: bool = False, + enable_stack_ensemble: bool = True, + enable_vote_ensemble: bool = True, + ensemble_model_download_timeout: datetime.timedelta = "PT5M", + stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.ClassificationModels"]]] = None, **kwargs: Any ) -> None: """ - :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 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 - train.py". Required. - :paramtype command: str - :keyword distribution: Distribution configuration of the job. If set, this should be one of - Mpi, Tensorflow, PyTorch, or null. - :paramtype distribution: ~azure.mgmt.machinelearningservices.models.DistributionConfiguration - :keyword environment_id: [Required] The ARM resource ID of the Environment specification for - the job. Required. - :paramtype environment_id: str - :keyword environment_variables: Environment variables included in the job. - :paramtype environment_variables: dict[str, str] - :keyword inputs: Mapping of input data bindings used in the job. - :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :keyword limits: Command Job limit. - :paramtype limits: ~azure.mgmt.machinelearningservices.models.CommandJobLimits - :keyword outputs: Mapping of output data bindings used in the job. - :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :keyword resources: Compute Resource configuration for the job. - :paramtype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration + :keyword enable_dnn_training: Enable recommendation of DNN models. + :paramtype enable_dnn_training: bool + :keyword enable_model_explainability: Flag to turn on explainability on best model. + :paramtype enable_model_explainability: bool + :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :paramtype enable_onnx_compatible_models: bool + :keyword enable_stack_ensemble: Enable stack ensemble run. + :paramtype enable_stack_ensemble: bool + :keyword enable_vote_ensemble: Enable voting ensemble run. + :paramtype enable_vote_ensemble: bool + :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :paramtype ensemble_model_download_timeout: ~datetime.timedelta + :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :paramtype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword allowed_training_algorithms: Allowed models for classification task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] + :keyword blocked_training_algorithms: Blocked models for classification task. + :paramtype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ClassificationModels] """ 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, + enable_dnn_training=enable_dnn_training, + enable_model_explainability=enable_model_explainability, + enable_onnx_compatible_models=enable_onnx_compatible_models, + enable_stack_ensemble=enable_stack_ensemble, + enable_vote_ensemble=enable_vote_ensemble, + ensemble_model_download_timeout=ensemble_model_download_timeout, + stack_ensemble_settings=stack_ensemble_settings, **kwargs ) - self.job_type: str = "Command" - self.code_id = code_id - self.command = command - self.distribution = distribution - self.environment_id = environment_id - self.environment_variables = environment_variables - self.inputs = inputs - self.limits = limits - self.outputs = outputs - self.parameters = None - self.resources = resources + self.allowed_training_algorithms = allowed_training_algorithms + self.blocked_training_algorithms = blocked_training_algorithms -class JobLimits(_serialization.Model): - """JobLimits. +class ClusterUpdateParameters(_serialization.Model): + """AmlCompute update parameters. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CommandJobLimits, SweepJobLimits - - All required parameters must be populated in order to send to Azure. - - :ivar job_limits_type: [Required] JobLimit type. Required. Known values are: "Command" and - "Sweep". - :vartype job_limits_type: str or ~azure.mgmt.machinelearningservices.models.JobLimitsType - :ivar timeout: The max run duration in ISO 8601 format, after which the job will be cancelled. - Only supports duration with precision as low as Seconds. - :vartype timeout: ~datetime.timedelta + :ivar properties: Properties of ClusterUpdate. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation """ - _validation = { - "job_limits_type": {"required": True}, - } - _attribute_map = { - "job_limits_type": {"key": "jobLimitsType", "type": "str"}, - "timeout": {"key": "timeout", "type": "duration"}, + "properties": {"key": "properties.properties", "type": "ScaleSettingsInformation"}, } - _subtype_map = {"job_limits_type": {"Command": "CommandJobLimits", "Sweep": "SweepJobLimits"}} - - def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: Optional["_models.ScaleSettingsInformation"] = None, **kwargs: Any) -> None: """ - :keyword timeout: The max run duration in ISO 8601 format, after which the job will be - cancelled. Only supports duration with precision as low as Seconds. - :paramtype timeout: ~datetime.timedelta + :keyword properties: Properties of ClusterUpdate. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScaleSettingsInformation """ super().__init__(**kwargs) - self.job_limits_type: Optional[str] = None - self.timeout = timeout + self.properties = properties -class CommandJobLimits(JobLimits): - """Command Job limit class. +class CodeConfiguration(_serialization.Model): + """Configuration for a scoring code asset. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar job_limits_type: [Required] JobLimit type. Required. Known values are: "Command" and - "Sweep". - :vartype job_limits_type: str or ~azure.mgmt.machinelearningservices.models.JobLimitsType - :ivar timeout: The max run duration in ISO 8601 format, after which the job will be cancelled. - Only supports duration with precision as low as Seconds. - :vartype timeout: ~datetime.timedelta + :ivar code_id: ARM resource ID of the code asset. + :vartype code_id: str + :ivar scoring_script: [Required] The script to execute on startup. eg. "score.py". Required. + :vartype scoring_script: str """ _validation = { - "job_limits_type": {"required": True}, + "scoring_script": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "job_limits_type": {"key": "jobLimitsType", "type": "str"}, - "timeout": {"key": "timeout", "type": "duration"}, + "code_id": {"key": "codeId", "type": "str"}, + "scoring_script": {"key": "scoringScript", "type": "str"}, } - def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: + def __init__(self, *, scoring_script: str, code_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword timeout: The max run duration in ISO 8601 format, after which the job will be - cancelled. Only supports duration with precision as low as Seconds. - :paramtype timeout: ~datetime.timedelta + :keyword code_id: ARM resource ID of the code asset. + :paramtype code_id: str + :keyword scoring_script: [Required] The script to execute on startup. eg. "score.py". Required. + :paramtype scoring_script: str """ - super().__init__(timeout=timeout, **kwargs) - self.job_limits_type: str = "Command" + super().__init__(**kwargs) + self.code_id = code_id + self.scoring_script = scoring_script -class ComponentContainer(Resource): +class CodeContainer(ProxyResource): """Azure Resource Manager resource envelope. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5081,7 +6466,7 @@ class ComponentContainer(Resource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComponentContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.CodeContainerProperties """ _validation = { @@ -5097,27 +6482,20 @@ class ComponentContainer(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ComponentContainerProperties"}, + "properties": {"key": "properties", "type": "CodeContainerProperties"}, } - def __init__(self, *, properties: "_models.ComponentContainerProperties", **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.CodeContainerProperties", **kwargs: Any) -> None: """ :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeContainerProperties """ super().__init__(**kwargs) self.properties = properties -class ComponentContainerProperties(AssetContainer): - """Component container definition. - - - .. raw:: html - - . +class CodeContainerProperties(AssetContainer): + """Container for code asset versions. Variables are only populated by the server, and will be ignored when sending a request. @@ -5133,7 +6511,7 @@ 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: + :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 @@ -5178,49 +6556,45 @@ def __init__( self.provisioning_state = None -class ComponentContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ComponentContainer entities. +class CodeContainerResourceArmPaginatedResult(_serialization.Model): + """A paginated list of CodeContainer entities. - :ivar next_link: The link to the next page of ComponentContainer objects. If null, there are no + :ivar next_link: The link to the next page of CodeContainer objects. If null, there are no additional pages. :vartype next_link: str - :ivar value: An array of objects of type ComponentContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :ivar value: An array of objects of type CodeContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] """ _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ComponentContainer]"}, + "value": {"key": "value", "type": "[CodeContainer]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ComponentContainer"]] = None, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.CodeContainer"]] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of ComponentContainer objects. If null, there are - no additional pages. + :keyword next_link: The link to the next page of CodeContainer objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type ComponentContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComponentContainer] + :keyword value: An array of objects of type CodeContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.CodeContainer] """ super().__init__(**kwargs) self.next_link = next_link self.value = value -class ComponentVersion(Resource): +class CodeVersion(ProxyResource): """Azure Resource Manager resource envelope. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -5231,7 +6605,7 @@ class ComponentVersion(Resource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.CodeVersionProperties """ _validation = { @@ -5247,20 +6621,20 @@ class ComponentVersion(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ComponentVersionProperties"}, + "properties": {"key": "properties", "type": "CodeVersionProperties"}, } - def __init__(self, *, properties: "_models.ComponentVersionProperties", **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.CodeVersionProperties", **kwargs: Any) -> None: """ :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.CodeVersionProperties """ super().__init__(**kwargs) self.properties = properties -class ComponentVersionProperties(AssetBase): - """Definition of a component version: defines resources that span component types. +class CodeVersionProperties(AssetBase): + """Code asset version details. Variables are only populated by the server, and will be ignored when sending a request. @@ -5274,16 +6648,9 @@ class ComponentVersionProperties(AssetBase): :vartype is_anonymous: bool :ivar is_archived: Is the asset archived?. :vartype is_archived: bool - :ivar component_spec: Defines Component definition details. - - - .. raw:: html - - . - :vartype component_spec: JSON - :ivar provisioning_state: Provisioning state for the component version. Known values are: + :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 @@ -5299,7 +6666,7 @@ class ComponentVersionProperties(AssetBase): "tags": {"key": "tags", "type": "{str}"}, "is_anonymous": {"key": "isAnonymous", "type": "bool"}, "is_archived": {"key": "isArchived", "type": "bool"}, - "component_spec": {"key": "componentSpec", "type": "object"}, + "code_uri": {"key": "codeUri", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, } @@ -5311,7 +6678,7 @@ def __init__( tags: Optional[Dict[str, str]] = None, is_anonymous: bool = False, is_archived: bool = False, - component_spec: Optional[JSON] = None, + code_uri: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -5325,15 +6692,8 @@ def __init__( :paramtype is_anonymous: bool :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool - :keyword component_spec: Defines Component definition details. - - - .. raw:: html - - . - :paramtype component_spec: JSON + :keyword code_uri: Uri where code is located. + :paramtype code_uri: str """ super().__init__( description=description, @@ -5343,825 +6703,669 @@ def __init__( is_archived=is_archived, **kwargs ) - self.component_spec = component_spec + self.code_uri = code_uri self.provisioning_state = None -class ComponentVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ComponentVersion entities. +class CodeVersionResourceArmPaginatedResult(_serialization.Model): + """A paginated list of CodeVersion entities. - :ivar next_link: The link to the next page of ComponentVersion objects. If null, there are no + :ivar next_link: The link to the next page of CodeVersion objects. If null, there are no additional pages. :vartype next_link: str - :ivar value: An array of objects of type ComponentVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :ivar value: An array of objects of type CodeVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.CodeVersion] """ _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ComponentVersion]"}, + "value": {"key": "value", "type": "[CodeVersion]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ComponentVersion"]] = None, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.CodeVersion"]] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of ComponentVersion objects. If null, there are - no additional pages. + :keyword next_link: The link to the next page of CodeVersion objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type ComponentVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComponentVersion] + :keyword value: An array of objects of type CodeVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.CodeVersion] """ super().__init__(**kwargs) self.next_link = next_link self.value = value -class ComputeInstanceSchema(_serialization.Model): - """Properties(top level) of ComputeInstance. - - :ivar properties: Properties of ComputeInstance. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.ComputeInstanceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Properties of ComputeInstance. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class ComputeInstance(Compute, ComputeInstanceSchema): # pylint: disable=too-many-instance-attributes - """An Azure Machine Learning compute instance. - - Variables are only populated by the server, and will be ignored when sending a request. +class CognitiveServiceEndpointDeploymentResourceProperties(_serialization.Model): # pylint: disable=name-too-long + """CognitiveServiceEndpointDeploymentResourceProperties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar properties: Properties of ComputeInstance. - :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties - :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 - :ivar compute_location: Location for the underlying 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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar model: Model used for the endpoint deployment. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar sku: + :vartype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :ivar version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ _validation = { - "compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, + "model": {"required": True}, } _attribute_map = { - "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "model": {"key": "model", "type": "EndpointDeploymentModel"}, + "rai_policy_name": {"key": "raiPolicyName", "type": "str"}, + "sku": {"key": "sku", "type": "CognitiveServicesSku"}, + "version_upgrade_option": {"key": "versionUpgradeOption", "type": "str"}, } def __init__( self, *, - properties: Optional["_models.ComputeInstanceProperties"] = None, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, + model: "_models.EndpointDeploymentModel", + rai_policy_name: Optional[str] = None, + sku: Optional["_models.CognitiveServicesSku"] = None, + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, **kwargs: Any ) -> None: """ - :keyword properties: Properties of ComputeInstance. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool - """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - properties=properties, - **kwargs - ) - self.properties = properties - self.compute_type: str = "ComputeInstance" - self.compute_location = compute_location - self.provisioning_state = None - self.description = description - self.created_on = None - self.modified_on = None - self.resource_id = resource_id - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = disable_local_auth - - -class ComputeInstanceApplication(_serialization.Model): - """Defines an Aml Instance application and its connectivity endpoint URI. - - :ivar display_name: Name of the ComputeInstance application. - :vartype display_name: str - :ivar endpoint_uri: Application' endpoint URI. - :vartype endpoint_uri: str - """ - - _attribute_map = { - "display_name": {"key": "displayName", "type": "str"}, - "endpoint_uri": {"key": "endpointUri", "type": "str"}, - } - - def __init__( - self, *, display_name: Optional[str] = None, endpoint_uri: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword display_name: Name of the ComputeInstance application. - :paramtype display_name: str - :keyword endpoint_uri: Application' endpoint URI. - :paramtype endpoint_uri: str + :keyword model: Model used for the endpoint deployment. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword sku: + :paramtype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :keyword version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ super().__init__(**kwargs) - self.display_name = display_name - self.endpoint_uri = endpoint_uri - - -class ComputeInstanceConnectivityEndpoints(_serialization.Model): - """Defines all connectivity endpoints and properties for an ComputeInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_ip_address: Public IP Address of this ComputeInstance. - :vartype public_ip_address: str - :ivar private_ip_address: Private IP Address of this ComputeInstance (local to the VNET in - which the compute instance is deployed). - :vartype private_ip_address: str - """ - - _validation = { - "public_ip_address": {"readonly": True}, - "private_ip_address": {"readonly": True}, - } - - _attribute_map = { - "public_ip_address": {"key": "publicIpAddress", "type": "str"}, - "private_ip_address": {"key": "privateIpAddress", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_ip_address = None - self.private_ip_address = None - + self.model = model + self.rai_policy_name = rai_policy_name + self.sku = sku + self.version_upgrade_option = version_upgrade_option -class ComputeInstanceContainer(_serialization.Model): - """Defines an Aml Instance container. - Variables are only populated by the server, and will be ignored when sending a request. +class CognitiveServicesSku(_serialization.Model): + """CognitiveServicesSku. - :ivar name: Name of the ComputeInstance container. + :ivar capacity: + :vartype capacity: int + :ivar family: + :vartype family: str + :ivar name: :vartype name: str - :ivar autosave: Auto save settings. Known values are: "None", "Local", and "Remote". - :vartype autosave: str or ~azure.mgmt.machinelearningservices.models.Autosave - :ivar gpu: Information of GPU. - :vartype gpu: str - :ivar network: network of this container. Known values are: "Bridge" and "Host". - :vartype network: str or ~azure.mgmt.machinelearningservices.models.Network - :ivar environment: Environment information of this container. - :vartype environment: ~azure.mgmt.machinelearningservices.models.ComputeInstanceEnvironmentInfo - :ivar services: services of this containers. - :vartype services: list[JSON] + :ivar size: + :vartype size: str + :ivar tier: + :vartype tier: str """ - _validation = { - "services": {"readonly": True}, - } - _attribute_map = { + "capacity": {"key": "capacity", "type": "int"}, + "family": {"key": "family", "type": "str"}, "name": {"key": "name", "type": "str"}, - "autosave": {"key": "autosave", "type": "str"}, - "gpu": {"key": "gpu", "type": "str"}, - "network": {"key": "network", "type": "str"}, - "environment": {"key": "environment", "type": "ComputeInstanceEnvironmentInfo"}, - "services": {"key": "services", "type": "[object]"}, + "size": {"key": "size", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } def __init__( self, *, + capacity: Optional[int] = None, + family: Optional[str] = None, name: Optional[str] = None, - autosave: Optional[Union[str, "_models.Autosave"]] = None, - gpu: Optional[str] = None, - network: Optional[Union[str, "_models.Network"]] = None, - environment: Optional["_models.ComputeInstanceEnvironmentInfo"] = None, + size: Optional[str] = None, + tier: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword name: Name of the ComputeInstance container. + :keyword capacity: + :paramtype capacity: int + :keyword family: + :paramtype family: str + :keyword name: :paramtype name: str - :keyword autosave: Auto save settings. Known values are: "None", "Local", and "Remote". - :paramtype autosave: str or ~azure.mgmt.machinelearningservices.models.Autosave - :keyword gpu: Information of GPU. - :paramtype gpu: str - :keyword network: network of this container. Known values are: "Bridge" and "Host". - :paramtype network: str or ~azure.mgmt.machinelearningservices.models.Network - :keyword environment: Environment information of this container. - :paramtype environment: - ~azure.mgmt.machinelearningservices.models.ComputeInstanceEnvironmentInfo + :keyword size: + :paramtype size: str + :keyword tier: + :paramtype tier: str """ super().__init__(**kwargs) + self.capacity = capacity + self.family = family self.name = name - self.autosave = autosave - self.gpu = gpu - self.network = network - self.environment = environment - self.services = None - + self.size = size + self.tier = tier -class ComputeInstanceCreatedBy(_serialization.Model): - """Describes information on user who created this ComputeInstance. - Variables are only populated by the server, and will be ignored when sending a request. +class Collection(_serialization.Model): + """Collection. - :ivar user_name: Name of the user. - :vartype user_name: str - :ivar user_org_id: Uniquely identifies user' Azure Active Directory organization. - :vartype user_org_id: str - :ivar user_id: Uniquely identifies the user within his/her organization. - :vartype user_id: str + :ivar client_id: The msi client id used to collect logging to blob storage. If it's + null,backend will pick a registered endpoint identity to auth. + :vartype client_id: str + :ivar data_collection_mode: Enable or disable data collection. Known values are: "Enabled" and + "Disabled". + :vartype data_collection_mode: str or + ~azure.mgmt.machinelearningservices.models.DataCollectionMode + :ivar data_id: The data asset arm resource id. Client side will ensure data asset is pointing + to the blob storage, and backend will collect data to the blob storage. + :vartype data_id: str + :ivar sampling_rate: The sampling rate for collection. Sampling rate 1.0 means we collect 100% + of data by default. + :vartype sampling_rate: float """ - _validation = { - "user_name": {"readonly": True}, - "user_org_id": {"readonly": True}, - "user_id": {"readonly": True}, - } - _attribute_map = { - "user_name": {"key": "userName", "type": "str"}, - "user_org_id": {"key": "userOrgId", "type": "str"}, - "user_id": {"key": "userId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "data_collection_mode": {"key": "dataCollectionMode", "type": "str"}, + "data_id": {"key": "dataId", "type": "str"}, + "sampling_rate": {"key": "samplingRate", "type": "float"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + client_id: Optional[str] = None, + data_collection_mode: Optional[Union[str, "_models.DataCollectionMode"]] = None, + data_id: Optional[str] = None, + sampling_rate: float = 1, + **kwargs: Any + ) -> None: + """ + :keyword client_id: The msi client id used to collect logging to blob storage. If it's + null,backend will pick a registered endpoint identity to auth. + :paramtype client_id: str + :keyword data_collection_mode: Enable or disable data collection. Known values are: "Enabled" + and "Disabled". + :paramtype data_collection_mode: str or + ~azure.mgmt.machinelearningservices.models.DataCollectionMode + :keyword data_id: The data asset arm resource id. Client side will ensure data asset is + pointing to the blob storage, and backend will collect data to the blob storage. + :paramtype data_id: str + :keyword sampling_rate: The sampling rate for collection. Sampling rate 1.0 means we collect + 100% of data by default. + :paramtype sampling_rate: float + """ super().__init__(**kwargs) - self.user_name = None - self.user_org_id = None - self.user_id = None + self.client_id = client_id + self.data_collection_mode = data_collection_mode + self.data_id = data_id + self.sampling_rate = sampling_rate -class ComputeInstanceDataDisk(_serialization.Model): - """Defines an Aml Instance DataDisk. +class ColumnTransformer(_serialization.Model): + """Column transformer parameters. - :ivar caching: Caching type of Data Disk. Known values are: "None", "ReadOnly", and - "ReadWrite". - :vartype caching: str or ~azure.mgmt.machinelearningservices.models.Caching - :ivar disk_size_gb: The initial disk size in gigabytes. - :vartype disk_size_gb: int - :ivar lun: The lun is used to uniquely identify each data disk. If attaching multiple disks, - each should have a distinct lun. - :vartype lun: int - :ivar storage_account_type: type of this storage account. Known values are: "Standard_LRS" and - "Premium_LRS". - :vartype storage_account_type: str or - ~azure.mgmt.machinelearningservices.models.StorageAccountType + :ivar fields: Fields to apply transformer logic on. + :vartype fields: list[str] + :ivar parameters: Different properties to be passed to transformer. + Input expected is dictionary of key,value pairs in JSON format. + :vartype parameters: JSON """ _attribute_map = { - "caching": {"key": "caching", "type": "str"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "lun": {"key": "lun", "type": "int"}, - "storage_account_type": {"key": "storageAccountType", "type": "str"}, + "fields": {"key": "fields", "type": "[str]"}, + "parameters": {"key": "parameters", "type": "object"}, } - def __init__( - self, - *, - caching: Optional[Union[str, "_models.Caching"]] = None, - disk_size_gb: Optional[int] = None, - lun: Optional[int] = None, - storage_account_type: Union[str, "_models.StorageAccountType"] = "Standard_LRS", - **kwargs: Any - ) -> None: + def __init__(self, *, fields: Optional[List[str]] = None, parameters: Optional[JSON] = None, **kwargs: Any) -> None: """ - :keyword caching: Caching type of Data Disk. Known values are: "None", "ReadOnly", and - "ReadWrite". - :paramtype caching: str or ~azure.mgmt.machinelearningservices.models.Caching - :keyword disk_size_gb: The initial disk size in gigabytes. - :paramtype disk_size_gb: int - :keyword lun: The lun is used to uniquely identify each data disk. If attaching multiple disks, - each should have a distinct lun. - :paramtype lun: int - :keyword storage_account_type: type of this storage account. Known values are: "Standard_LRS" - and "Premium_LRS". - :paramtype storage_account_type: str or - ~azure.mgmt.machinelearningservices.models.StorageAccountType + :keyword fields: Fields to apply transformer logic on. + :paramtype fields: list[str] + :keyword parameters: Different properties to be passed to transformer. + Input expected is dictionary of key,value pairs in JSON format. + :paramtype parameters: JSON """ super().__init__(**kwargs) - self.caching = caching - self.disk_size_gb = disk_size_gb - self.lun = lun - self.storage_account_type = storage_account_type + self.fields = fields + self.parameters = parameters -class ComputeInstanceDataMount(_serialization.Model): - """Defines an Aml Instance DataMount. +class CommandJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Command job definition. - :ivar source: Source of the ComputeInstance data mount. - :vartype source: str - :ivar source_type: Data source type. Known values are: "Dataset", "Datastore", and "URI". - :vartype source_type: str or ~azure.mgmt.machinelearningservices.models.SourceType - :ivar mount_name: name of the ComputeInstance data mount. - :vartype mount_name: str - :ivar mount_action: Mount Action. Known values are: "Mount" and "Unmount". - :vartype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction - :ivar created_by: who this data mount created by. - :vartype created_by: str - :ivar mount_path: Path of this data mount. - :vartype mount_path: str - :ivar mount_state: Mount state. Known values are: "MountRequested", "Mounted", "MountFailed", - "UnmountRequested", "UnmountFailed", and "Unmounted". - :vartype mount_state: str or ~azure.mgmt.machinelearningservices.models.MountState - :ivar mounted_on: The time when the disk mounted. - :vartype mounted_on: ~datetime.datetime - :ivar error: Error of this data mount. - :vartype error: str + 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 server. + + :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", "Sweep", "Pipeline", "Spark", and "FineTuning". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :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". + Required. + :vartype command: str + :ivar distribution: Distribution configuration of the job. If set, this should be one of Mpi, + Tensorflow, PyTorch, or null. + :vartype distribution: ~azure.mgmt.machinelearningservices.models.DistributionConfiguration + :ivar environment_id: [Required] The ARM resource ID of the Environment specification for the + job. Required. + :vartype environment_id: str + :ivar environment_variables: Environment variables included in the job. + :vartype environment_variables: dict[str, str] + :ivar inputs: Mapping of input data bindings used in the job. + :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :ivar limits: Command Job limit. + :vartype limits: ~azure.mgmt.machinelearningservices.models.CommandJobLimits + :ivar outputs: Mapping of output data bindings used in the job. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar parameters: Input parameters. + :vartype parameters: JSON + :ivar queue_settings: Queue settings for the job. + :vartype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :ivar resources: Compute Resource configuration for the job. + :vartype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration """ + _validation = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "command": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "environment_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "parameters": {"readonly": True}, + } + _attribute_map = { - "source": {"key": "source", "type": "str"}, - "source_type": {"key": "sourceType", "type": "str"}, - "mount_name": {"key": "mountName", "type": "str"}, - "mount_action": {"key": "mountAction", "type": "str"}, - "created_by": {"key": "createdBy", "type": "str"}, - "mount_path": {"key": "mountPath", "type": "str"}, - "mount_state": {"key": "mountState", "type": "str"}, - "mounted_on": {"key": "mountedOn", "type": "iso-8601"}, - "error": {"key": "error", "type": "str"}, + "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"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "code_id": {"key": "codeId", "type": "str"}, + "command": {"key": "command", "type": "str"}, + "distribution": {"key": "distribution", "type": "DistributionConfiguration"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "inputs": {"key": "inputs", "type": "{JobInput}"}, + "limits": {"key": "limits", "type": "CommandJobLimits"}, + "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "parameters": {"key": "parameters", "type": "object"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, + "resources": {"key": "resources", "type": "JobResourceConfiguration"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - source: Optional[str] = None, - source_type: Optional[Union[str, "_models.SourceType"]] = None, - mount_name: Optional[str] = None, - mount_action: Optional[Union[str, "_models.MountAction"]] = None, - created_by: Optional[str] = None, - mount_path: Optional[str] = None, - mount_state: Optional[Union[str, "_models.MountState"]] = None, - mounted_on: Optional[datetime.datetime] = None, - error: Optional[str] = None, + command: str, + environment_id: str, + 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + services: Optional[Dict[str, "_models.JobService"]] = None, + code_id: Optional[str] = None, + distribution: Optional["_models.DistributionConfiguration"] = None, + environment_variables: Optional[Dict[str, str]] = None, + inputs: Optional[Dict[str, "_models.JobInput"]] = None, + limits: Optional["_models.CommandJobLimits"] = None, + outputs: Optional[Dict[str, "_models.JobOutput"]] = None, + queue_settings: Optional["_models.QueueSettings"] = None, + resources: Optional["_models.JobResourceConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword source: Source of the ComputeInstance data mount. - :paramtype source: str - :keyword source_type: Data source type. Known values are: "Dataset", "Datastore", and "URI". - :paramtype source_type: str or ~azure.mgmt.machinelearningservices.models.SourceType - :keyword mount_name: name of the ComputeInstance data mount. - :paramtype mount_name: str - :keyword mount_action: Mount Action. Known values are: "Mount" and "Unmount". - :paramtype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction - :keyword created_by: who this data mount created by. - :paramtype created_by: str - :keyword mount_path: Path of this data mount. - :paramtype mount_path: str - :keyword mount_state: Mount state. Known values are: "MountRequested", "Mounted", - "MountFailed", "UnmountRequested", "UnmountFailed", and "Unmounted". - :paramtype mount_state: str or ~azure.mgmt.machinelearningservices.models.MountState - :keyword mounted_on: The time when the disk mounted. - :paramtype mounted_on: ~datetime.datetime - :keyword error: Error of this data mount. - :paramtype error: str + :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 notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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 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 + train.py". Required. + :paramtype command: str + :keyword distribution: Distribution configuration of the job. If set, this should be one of + Mpi, Tensorflow, PyTorch, or null. + :paramtype distribution: ~azure.mgmt.machinelearningservices.models.DistributionConfiguration + :keyword environment_id: [Required] The ARM resource ID of the Environment specification for + the job. Required. + :paramtype environment_id: str + :keyword environment_variables: Environment variables included in the job. + :paramtype environment_variables: dict[str, str] + :keyword inputs: Mapping of input data bindings used in the job. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword limits: Command Job limit. + :paramtype limits: ~azure.mgmt.machinelearningservices.models.CommandJobLimits + :keyword outputs: Mapping of output data bindings used in the job. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword queue_settings: Queue settings for the job. + :paramtype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :keyword resources: Compute Resource configuration for the job. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.JobResourceConfiguration """ - super().__init__(**kwargs) - self.source = source - self.source_type = source_type - self.mount_name = mount_name - self.mount_action = mount_action - self.created_by = created_by - self.mount_path = mount_path - self.mount_state = mount_state - self.mounted_on = mounted_on - self.error = error + 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, + notification_setting=notification_setting, + services=services, + **kwargs + ) + self.job_type: str = "Command" + self.code_id = code_id + self.command = command + self.distribution = distribution + self.environment_id = environment_id + self.environment_variables = environment_variables + self.inputs = inputs + self.limits = limits + self.outputs = outputs + self.parameters = None + self.queue_settings = queue_settings + self.resources = resources -class ComputeInstanceEnvironmentInfo(_serialization.Model): - """Environment information. +class JobLimits(_serialization.Model): + """JobLimits. - :ivar name: name of environment. - :vartype name: str - :ivar version: version of environment. - :vartype version: str + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CommandJobLimits, SweepJobLimits + + All required parameters must be populated in order to send to server. + + :ivar job_limits_type: [Required] JobLimit type. Required. Known values are: "Command" and + "Sweep". + :vartype job_limits_type: str or ~azure.mgmt.machinelearningservices.models.JobLimitsType + :ivar timeout: The max run duration in ISO 8601 format, after which the job will be cancelled. + Only supports duration with precision as low as Seconds. + :vartype timeout: ~datetime.timedelta """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "version": {"key": "version", "type": "str"}, + _validation = { + "job_limits_type": {"required": True}, } - def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: + _attribute_map = { + "job_limits_type": {"key": "jobLimitsType", "type": "str"}, + "timeout": {"key": "timeout", "type": "duration"}, + } + + _subtype_map = {"job_limits_type": {"Command": "CommandJobLimits", "Sweep": "SweepJobLimits"}} + + def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: """ - :keyword name: name of environment. - :paramtype name: str - :keyword version: version of environment. - :paramtype version: str + :keyword timeout: The max run duration in ISO 8601 format, after which the job will be + cancelled. Only supports duration with precision as low as Seconds. + :paramtype timeout: ~datetime.timedelta """ super().__init__(**kwargs) - self.name = name - self.version = version + self.job_limits_type: Optional[str] = None + self.timeout = timeout -class ComputeInstanceLastOperation(_serialization.Model): - """The last operation on ComputeInstance. +class CommandJobLimits(JobLimits): + """Command Job limit class. - :ivar operation_name: Name of the last operation. Known values are: "Create", "Start", "Stop", - "Restart", "Reimage", and "Delete". - :vartype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName - :ivar operation_time: Time of the last operation. - :vartype operation_time: ~datetime.datetime - :ivar operation_status: Operation status. Known values are: "InProgress", "Succeeded", - "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", and - "DeleteFailed". - :vartype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus - :ivar operation_trigger: Trigger of operation. Known values are: "User", "Schedule", and - "IdleShutdown". - :vartype operation_trigger: str or ~azure.mgmt.machinelearningservices.models.OperationTrigger + All required parameters must be populated in order to send to server. + + :ivar job_limits_type: [Required] JobLimit type. Required. Known values are: "Command" and + "Sweep". + :vartype job_limits_type: str or ~azure.mgmt.machinelearningservices.models.JobLimitsType + :ivar timeout: The max run duration in ISO 8601 format, after which the job will be cancelled. + Only supports duration with precision as low as Seconds. + :vartype timeout: ~datetime.timedelta """ + _validation = { + "job_limits_type": {"required": True}, + } + _attribute_map = { - "operation_name": {"key": "operationName", "type": "str"}, - "operation_time": {"key": "operationTime", "type": "iso-8601"}, - "operation_status": {"key": "operationStatus", "type": "str"}, - "operation_trigger": {"key": "operationTrigger", "type": "str"}, + "job_limits_type": {"key": "jobLimitsType", "type": "str"}, + "timeout": {"key": "timeout", "type": "duration"}, } - def __init__( - self, - *, - operation_name: Optional[Union[str, "_models.OperationName"]] = None, - operation_time: Optional[datetime.datetime] = None, - operation_status: Optional[Union[str, "_models.OperationStatus"]] = None, - operation_trigger: Optional[Union[str, "_models.OperationTrigger"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, timeout: Optional[datetime.timedelta] = None, **kwargs: Any) -> None: """ - :keyword operation_name: Name of the last operation. Known values are: "Create", "Start", - "Stop", "Restart", "Reimage", and "Delete". - :paramtype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName - :keyword operation_time: Time of the last operation. - :paramtype operation_time: ~datetime.datetime - :keyword operation_status: Operation status. Known values are: "InProgress", "Succeeded", - "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ReimageFailed", and - "DeleteFailed". - :paramtype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus - :keyword operation_trigger: Trigger of operation. Known values are: "User", "Schedule", and - "IdleShutdown". - :paramtype operation_trigger: str or - ~azure.mgmt.machinelearningservices.models.OperationTrigger + :keyword timeout: The max run duration in ISO 8601 format, after which the job will be + cancelled. Only supports duration with precision as low as Seconds. + :paramtype timeout: ~datetime.timedelta + """ + super().__init__(timeout=timeout, **kwargs) + self.job_limits_type: str = "Command" + + +class ComponentContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.ComponentContainerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "ComponentContainerProperties"}, + } + + def __init__(self, *, properties: "_models.ComponentContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentContainerProperties """ super().__init__(**kwargs) - self.operation_name = operation_name - self.operation_time = operation_time - self.operation_status = operation_status - self.operation_trigger = operation_trigger + self.properties = properties -class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Compute Instance properties. +class ComponentContainerProperties(AssetContainer): + """Component container definition. + + + .. raw:: html + + . Variables are only populated by the server, and will be ignored when sending a request. - :ivar vm_size: Virtual Machine Size. - :vartype vm_size: str - :ivar subnet: Virtual network subnet resource ID the compute nodes belong to. - :vartype subnet: ~azure.mgmt.machinelearningservices.models.ResourceId - :ivar application_sharing_policy: Policy for sharing applications on this compute instance - among users of parent workspace. If Personal, only the creator can access applications on this - compute instance. When Shared, any workspace user can access applications on this instance - depending on his/her assigned role. Known values are: "Personal" and "Shared". - :vartype application_sharing_policy: str or - ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy - :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: - ~azure.mgmt.machinelearningservices.models.ComputeInstanceConnectivityEndpoints - :ivar applications: Describes available applications and their endpoints on this - ComputeInstance. - :vartype applications: - list[~azure.mgmt.machinelearningservices.models.ComputeInstanceApplication] - :ivar created_by: Describes information on user who created this ComputeInstance. - :vartype created_by: ~azure.mgmt.machinelearningservices.models.ComputeInstanceCreatedBy - :ivar errors: Collection of errors encountered on this ComputeInstance. - :vartype errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar state: The current state of this ComputeInstance. Known values are: "Creating", - "CreateFailed", "Deleting", "Running", "Restarting", "JobRunning", "SettingUp", "SetupFailed", - "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", "Unknown", and - "Unusable". - :vartype state: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceState - :ivar compute_instance_authorization_type: The Compute Instance Authorization type. Available - values are personal (default). "personal" - :vartype compute_instance_authorization_type: str or - ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType - :ivar personal_compute_instance_settings: Settings for a personal compute instance. - :vartype personal_compute_instance_settings: - ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings - :ivar setup_scripts: Details of customized scripts to execute for setting up the cluster. - :vartype setup_scripts: ~azure.mgmt.machinelearningservices.models.SetupScripts - :ivar last_operation: The last operation on ComputeInstance. - :vartype last_operation: - ~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 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 - public IPs. - :vartype enable_node_public_ip: bool - :ivar containers: Describes informations of containers on this ComputeInstance. - :vartype containers: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceContainer] - :ivar data_disks: Describes informations of dataDisks on this ComputeInstance. - :vartype data_disks: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataDisk] - :ivar data_mounts: Describes informations of dataMounts on this ComputeInstance. - :vartype data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] - :ivar versions: ComputeInstance version. - :vartype versions: ~azure.mgmt.machinelearningservices.models.ComputeInstanceVersion + :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 is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :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 = { - "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}, - "containers": {"readonly": True}, - "data_disks": {"readonly": True}, - "data_mounts": {"readonly": True}, - "versions": {"readonly": True}, + "latest_version": {"readonly": True}, + "next_version": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "vm_size": {"key": "vmSize", "type": "str"}, - "subnet": {"key": "subnet", "type": "ResourceId"}, - "application_sharing_policy": {"key": "applicationSharingPolicy", "type": "str"}, - "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"}, - "errors": {"key": "errors", "type": "[ErrorResponse]"}, - "state": {"key": "state", "type": "str"}, - "compute_instance_authorization_type": {"key": "computeInstanceAuthorizationType", "type": "str"}, - "personal_compute_instance_settings": { - "key": "personalComputeInstanceSettings", - "type": "PersonalComputeInstanceSettings", - }, - "setup_scripts": {"key": "setupScripts", "type": "SetupScripts"}, - "last_operation": {"key": "lastOperation", "type": "ComputeInstanceLastOperation"}, - "schedules": {"key": "schedules", "type": "ComputeSchedules"}, - "enable_node_public_ip": {"key": "enableNodePublicIp", "type": "bool"}, - "containers": {"key": "containers", "type": "[ComputeInstanceContainer]"}, - "data_disks": {"key": "dataDisks", "type": "[ComputeInstanceDataDisk]"}, - "data_mounts": {"key": "dataMounts", "type": "[ComputeInstanceDataMount]"}, - "versions": {"key": "versions", "type": "ComputeInstanceVersion"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( self, *, - vm_size: Optional[str] = None, - subnet: Optional["_models.ResourceId"] = None, - application_sharing_policy: Union[str, "_models.ApplicationSharingPolicy"] = "Shared", - 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, - enable_node_public_ip: Optional[bool] = None, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: bool = False, **kwargs: Any ) -> None: """ - :keyword vm_size: Virtual Machine Size. - :paramtype vm_size: str - :keyword subnet: Virtual network subnet resource ID the compute nodes belong to. - :paramtype subnet: ~azure.mgmt.machinelearningservices.models.ResourceId - :keyword application_sharing_policy: Policy for sharing applications on this compute instance - among users of parent workspace. If Personal, only the creator can access applications on this - compute instance. When Shared, any workspace user can access applications on this instance - depending on his/her assigned role. Known values are: "Personal" and "Shared". - :paramtype application_sharing_policy: str or - ~azure.mgmt.machinelearningservices.models.ApplicationSharingPolicy - :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 - ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType - :keyword personal_compute_instance_settings: Settings for a personal compute instance. - :paramtype personal_compute_instance_settings: - ~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 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 - public IPs. - :paramtype enable_node_public_ip: bool + :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 is_archived: Is the asset archived?. + :paramtype is_archived: bool """ - super().__init__(**kwargs) - self.vm_size = vm_size - self.subnet = subnet - self.application_sharing_policy = application_sharing_policy - 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 - self.errors = None - self.state = None - self.compute_instance_authorization_type = compute_instance_authorization_type - self.personal_compute_instance_settings = personal_compute_instance_settings - self.setup_scripts = setup_scripts - self.last_operation = None - self.schedules = schedules - self.enable_node_public_ip = enable_node_public_ip - self.containers = None - self.data_disks = None - self.data_mounts = None - self.versions = None - + super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None -class ComputeInstanceSshSettings(_serialization.Model): - """Specifies policy and settings for SSH access. - Variables are only populated by the server, and will be ignored when sending a request. +class ComponentContainerResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of ComponentContainer entities. - :ivar ssh_public_access: 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 accessible according to the VNet/subnet policy if applicable. Known - values are: "Enabled" and "Disabled". - :vartype ssh_public_access: str or ~azure.mgmt.machinelearningservices.models.SshPublicAccess - :ivar admin_user_name: Describes the admin user name. - :vartype admin_user_name: str - :ivar ssh_port: Describes the port for connecting through SSH. - :vartype ssh_port: int - :ivar admin_public_key: Specifies the SSH rsa public key file as a string. Use "ssh-keygen -t - rsa -b 2048" to generate your SSH key pairs. - :vartype admin_public_key: str + :ivar next_link: The link to the next page of ComponentContainer objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ComponentContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ComponentContainer] """ - _validation = { - "admin_user_name": {"readonly": True}, - "ssh_port": {"readonly": True}, - } - _attribute_map = { - "ssh_public_access": {"key": "sshPublicAccess", "type": "str"}, - "admin_user_name": {"key": "adminUserName", "type": "str"}, - "ssh_port": {"key": "sshPort", "type": "int"}, - "admin_public_key": {"key": "adminPublicKey", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ComponentContainer]"}, } def __init__( self, *, - ssh_public_access: Union[str, "_models.SshPublicAccess"] = "Disabled", - admin_public_key: Optional[str] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.ComponentContainer"]] = None, **kwargs: Any ) -> None: """ - :keyword ssh_public_access: 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 accessible according to the VNet/subnet policy if applicable. Known - values are: "Enabled" and "Disabled". - :paramtype ssh_public_access: str or ~azure.mgmt.machinelearningservices.models.SshPublicAccess - :keyword admin_public_key: Specifies the SSH rsa public key file as a string. Use "ssh-keygen - -t rsa -b 2048" to generate your SSH key pairs. - :paramtype admin_public_key: str - """ - super().__init__(**kwargs) - self.ssh_public_access = ssh_public_access - self.admin_user_name = None - self.ssh_port = None - self.admin_public_key = admin_public_key - - -class ComputeInstanceVersion(_serialization.Model): - """Version of computeInstance. - - :ivar runtime: Runtime of compute instance. - :vartype runtime: str - """ - - _attribute_map = { - "runtime": {"key": "runtime", "type": "str"}, - } - - def __init__(self, *, runtime: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword runtime: Runtime of compute instance. - :paramtype runtime: str - """ - super().__init__(**kwargs) - self.runtime = runtime - - -class ComputeResourceSchema(_serialization.Model): - """ComputeResourceSchema. - - :ivar properties: Compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.Compute - """ - - _attribute_map = { - "properties": {"key": "properties", "type": "Compute"}, - } - - def __init__(self, *, properties: Optional["_models.Compute"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.Compute + :keyword next_link: The link to the next page of ComponentContainer objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ComponentContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComponentContainer] """ super().__init__(**kwargs) - self.properties = properties + self.next_link = next_link + self.value = value -class ComputeResource(Resource, ComputeResourceSchema): - """Machine Learning compute object wrapped into ARM resource envelope. +class ComponentVersion(ProxyResource): + """Azure Resource Manager resource envelope. Variables are only populated by the server, and will be ignored when sending a request. - :ivar properties: Compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.Compute + All required parameters must be populated in order to send to server. + :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -6171,14 +7375,8 @@ class ComputeResource(Resource, ComputeResourceSchema): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties """ _validation = { @@ -6186,1070 +7384,1064 @@ class ComputeResource(Resource, ComputeResourceSchema): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "properties": {"key": "properties", "type": "Compute"}, "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, + "properties": {"key": "properties", "type": "ComponentVersionProperties"}, } - def __init__( - self, - *, - properties: Optional["_models.Compute"] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.ComponentVersionProperties", **kwargs: Any) -> None: """ - :keyword properties: Compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.Compute - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComponentVersionProperties """ - super().__init__(properties=properties, **kwargs) + super().__init__(**kwargs) self.properties = properties - self.identity = identity - self.location = location - self.tags = tags - self.sku = sku - self.id = None - self.name = None - self.type = None - self.system_data = None -class ComputeSchedules(_serialization.Model): - """The list of schedules to be applied on the computes. +class ComponentVersionProperties(AssetBase): + """Definition of a component version: defines resources that span component types. - :ivar compute_start_stop: The list of compute start stop schedules to be applied. - :vartype compute_start_stop: - list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "compute_start_stop": {"key": "computeStartStop", "type": "[ComputeStartStopSchedule]"}, - } + :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 is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar component_spec: Defines Component definition details. - def __init__( - self, *, compute_start_stop: Optional[List["_models.ComputeStartStopSchedule"]] = None, **kwargs: Any - ) -> None: - """ - :keyword compute_start_stop: The list of compute start stop schedules to be applied. - :paramtype compute_start_stop: - list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] - """ - super().__init__(**kwargs) - self.compute_start_stop = compute_start_stop + .. raw:: html -class ComputeStartStopSchedule(_serialization.Model): - """Compute start stop schedule properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: A system assigned id for the schedule. - :vartype id: str - :ivar provisioning_status: The current deployment state of schedule. Known values are: - "Completed", "Provisioning", and "Failed". - :vartype provisioning_status: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningStatus - :ivar status: Is the schedule enabled or disabled?. Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus - :ivar action: [Required] The compute power action. Known values are: "Start" and "Stop". - :vartype action: str or ~azure.mgmt.machinelearningservices.models.ComputePowerAction - :ivar trigger_type: [Required] The schedule trigger type. Known values are: "Recurrence" and - "Cron". - :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType - :ivar recurrence: Required if triggerType is Recurrence. - :vartype recurrence: ~azure.mgmt.machinelearningservices.models.Recurrence - :ivar cron: Required if triggerType is Cron. - :vartype cron: ~azure.mgmt.machinelearningservices.models.Cron - :ivar schedule: [Deprecated] Not used any more. - :vartype schedule: ~azure.mgmt.machinelearningservices.models.ScheduleBase + . + :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 = { - "id": {"readonly": True}, - "provisioning_status": {"readonly": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "recurrence": {"key": "recurrence", "type": "Recurrence"}, - "cron": {"key": "cron", "type": "Cron"}, - "schedule": {"key": "schedule", "type": "ScheduleBase"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( self, *, - status: Optional[Union[str, "_models.ScheduleStatus"]] = None, - action: Optional[Union[str, "_models.ComputePowerAction"]] = None, - trigger_type: Optional[Union[str, "_models.TriggerType"]] = None, - recurrence: Optional["_models.Recurrence"] = None, - cron: Optional["_models.Cron"] = None, - schedule: Optional["_models.ScheduleBase"] = None, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + component_spec: Optional[JSON] = None, **kwargs: Any ) -> None: """ - :keyword status: Is the schedule enabled or disabled?. Known values are: "Enabled" and - "Disabled". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus - :keyword action: [Required] The compute power action. Known values are: "Start" and "Stop". - :paramtype action: str or ~azure.mgmt.machinelearningservices.models.ComputePowerAction - :keyword trigger_type: [Required] The schedule trigger type. Known values are: "Recurrence" and - "Cron". - :paramtype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType - :keyword recurrence: Required if triggerType is Recurrence. - :paramtype recurrence: ~azure.mgmt.machinelearningservices.models.Recurrence - :keyword cron: Required if triggerType is Cron. - :paramtype cron: ~azure.mgmt.machinelearningservices.models.Cron - :keyword schedule: [Deprecated] Not used any more. - :paramtype schedule: ~azure.mgmt.machinelearningservices.models.ScheduleBase + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword component_spec: Defines Component definition details. + + + .. raw:: html + + . + :paramtype component_spec: JSON """ - super().__init__(**kwargs) - self.id = None - self.provisioning_status = None - self.status = status - self.action = action - self.trigger_type = trigger_type - self.recurrence = recurrence - self.cron = cron - self.schedule = schedule + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.component_spec = component_spec + self.provisioning_state = None -class ContainerResourceRequirements(_serialization.Model): - """Resource requirements for each container instance within an online deployment. +class ComponentVersionResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of ComponentVersion entities. - :ivar container_resource_limits: Container resource limit info:. - :vartype container_resource_limits: - ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings - :ivar container_resource_requests: Container resource request info:. - :vartype container_resource_requests: - ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings + :ivar next_link: The link to the next page of ComponentVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ComponentVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ComponentVersion] """ _attribute_map = { - "container_resource_limits": {"key": "containerResourceLimits", "type": "ContainerResourceSettings"}, - "container_resource_requests": {"key": "containerResourceRequests", "type": "ContainerResourceSettings"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ComponentVersion]"}, } def __init__( self, *, - container_resource_limits: Optional["_models.ContainerResourceSettings"] = None, - container_resource_requests: Optional["_models.ContainerResourceSettings"] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.ComponentVersion"]] = None, **kwargs: Any ) -> None: """ - :keyword container_resource_limits: Container resource limit info:. - :paramtype container_resource_limits: - ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings - :keyword container_resource_requests: Container resource request info:. - :paramtype container_resource_requests: - ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings + :keyword next_link: The link to the next page of ComponentVersion objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ComponentVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComponentVersion] """ super().__init__(**kwargs) - self.container_resource_limits = container_resource_limits - self.container_resource_requests = container_resource_requests + self.next_link = next_link + self.value = value -class ContainerResourceSettings(_serialization.Model): - """ContainerResourceSettings. +class ComputeInstanceSchema(_serialization.Model): + """Properties(top level) of ComputeInstance. - :ivar cpu: Number of vCPUs request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :vartype cpu: str - :ivar gpu: Number of Nvidia GPU cards request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :vartype gpu: str - :ivar memory: Memory size request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :vartype memory: str + :ivar properties: Properties of ComputeInstance. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties """ _attribute_map = { - "cpu": {"key": "cpu", "type": "str"}, - "gpu": {"key": "gpu", "type": "str"}, - "memory": {"key": "memory", "type": "str"}, + "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, } - def __init__( - self, *, cpu: Optional[str] = None, gpu: Optional[str] = None, memory: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ComputeInstanceProperties"] = None, **kwargs: Any) -> None: """ - :keyword cpu: Number of vCPUs request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :paramtype cpu: str - :keyword gpu: Number of Nvidia GPU cards request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :paramtype gpu: str - :keyword memory: Memory size request/limit for container. More info: - https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. - :paramtype memory: str + :keyword properties: Properties of ComputeInstance. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties """ super().__init__(**kwargs) - self.cpu = cpu - self.gpu = gpu - self.memory = memory - - -class CosmosDbSettings(_serialization.Model): - """CosmosDbSettings. - - :ivar collections_throughput: The throughput of the collections in cosmosdb database. - :vartype collections_throughput: int - """ + self.properties = properties - _attribute_map = { - "collections_throughput": {"key": "collectionsThroughput", "type": "int"}, - } - def __init__(self, *, collections_throughput: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword collections_throughput: The throughput of the collections in cosmosdb database. - :paramtype collections_throughput: int - """ - super().__init__(**kwargs) - self.collections_throughput = collections_throughput +class ComputeInstance(Compute, ComputeInstanceSchema): # pylint: disable=too-many-instance-attributes + """An Azure Machine Learning compute instance. + Variables are only populated by the server, and will be ignored when sending a request. -class Cron(_serialization.Model): - """The workflow trigger cron for ComputeStartStop schedule type. + All required parameters must be populated in order to send to server. - :ivar start_time: The start time in yyyy-MM-ddTHH:mm:ss format. - :vartype start_time: str - :ivar time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :vartype time_zone: str - :ivar expression: [Required] Specifies cron expression of schedule. - The expression should follow NCronTab format. - :vartype expression: str + :ivar properties: Properties of ComputeInstance. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties + :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 + :ivar compute_location: Location for the underlying 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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool """ + _validation = { + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, + } + _attribute_map = { - "start_time": {"key": "startTime", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "expression": {"key": "expression", "type": "str"}, + "properties": {"key": "properties", "type": "ComputeInstanceProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, } def __init__( self, *, - start_time: Optional[str] = None, - time_zone: str = "UTC", - expression: Optional[str] = None, + properties: Optional["_models.ComputeInstanceProperties"] = None, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword start_time: The start time in yyyy-MM-ddTHH:mm:ss format. - :paramtype start_time: str - :keyword time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :paramtype time_zone: str - :keyword expression: [Required] Specifies cron expression of schedule. - The expression should follow NCronTab format. - :paramtype expression: str + :keyword properties: Properties of ComputeInstance. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ComputeInstanceProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool """ - super().__init__(**kwargs) - self.start_time = start_time - self.time_zone = time_zone - self.expression = expression - - -class TriggerBase(_serialization.Model): - """TriggerBase. + super().__init__( + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, + properties=properties, + **kwargs + ) + self.properties = properties + self.compute_type: str = "ComputeInstance" + self.compute_location = compute_location + self.provisioning_state = None + self.description = description + self.created_on = None + self.modified_on = None + self.resource_id = resource_id + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = disable_local_auth - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CronTrigger, RecurrenceTrigger - All required parameters must be populated in order to send to Azure. +class ComputeInstanceApplication(_serialization.Model): + """Defines an Aml Instance application and its connectivity endpoint URI. - :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :vartype end_time: str - :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :vartype start_time: str - :ivar time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :vartype time_zone: str - :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". - :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType + :ivar display_name: Name of the ComputeInstance application. + :vartype display_name: str + :ivar endpoint_uri: Application' endpoint URI. + :vartype endpoint_uri: str """ - _validation = { - "trigger_type": {"required": True}, - } - _attribute_map = { - "end_time": {"key": "endTime", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, } - _subtype_map = {"trigger_type": {"Cron": "CronTrigger", "Recurrence": "RecurrenceTrigger"}} - def __init__( - self, *, end_time: Optional[str] = None, start_time: Optional[str] = None, time_zone: str = "UTC", **kwargs: Any + self, *, display_name: Optional[str] = None, endpoint_uri: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :paramtype end_time: str - :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :paramtype start_time: str - :keyword time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :paramtype time_zone: str + :keyword display_name: Name of the ComputeInstance application. + :paramtype display_name: str + :keyword endpoint_uri: Application' endpoint URI. + :paramtype endpoint_uri: str """ super().__init__(**kwargs) - self.end_time = end_time - self.start_time = start_time - self.time_zone = time_zone - self.trigger_type: Optional[str] = None - + self.display_name = display_name + self.endpoint_uri = endpoint_uri -class CronTrigger(TriggerBase): - """CronTrigger. - All required parameters must be populated in order to send to Azure. +class ComputeInstanceAutologgerSettings(_serialization.Model): + """Specifies settings for autologger. - :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :vartype end_time: str - :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :vartype start_time: str - :ivar time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :vartype time_zone: str - :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". - :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType - :ivar expression: [Required] Specifies cron expression of schedule. - The expression should follow NCronTab format. Required. - :vartype expression: str + :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 """ - _validation = { - "trigger_type": {"required": True}, - "expression": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - } - _attribute_map = { - "end_time": {"key": "endTime", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "expression": {"key": "expression", "type": "str"}, + "mlflow_autologger": {"key": "mlflowAutologger", "type": "str"}, } def __init__( - self, - *, - expression: str, - end_time: Optional[str] = None, - start_time: Optional[str] = None, - time_zone: str = "UTC", - **kwargs: Any + self, *, mlflow_autologger: Optional[Union[str, "_models.MlflowAutologger"]] = None, **kwargs: Any ) -> None: """ - :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :paramtype end_time: str - :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :paramtype start_time: str - :keyword time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :paramtype time_zone: str - :keyword expression: [Required] Specifies cron expression of schedule. - The expression should follow NCronTab format. Required. - :paramtype expression: str + :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__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) - self.trigger_type: str = "Cron" - self.expression = expression + super().__init__(**kwargs) + self.mlflow_autologger = mlflow_autologger -class CustomForecastHorizon(ForecastHorizon): - """The desired maximum forecast horizon in units of time-series frequency. +class ComputeInstanceConnectivityEndpoints(_serialization.Model): + """Defines all connectivity endpoints and properties for an ComputeInstance. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar mode: [Required] Set forecast horizon value selection mode. Required. Known values are: - "Auto" and "Custom". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.ForecastHorizonMode - :ivar value: [Required] Forecast horizon value. Required. - :vartype value: int + :ivar public_ip_address: Public IP Address of this ComputeInstance. + :vartype public_ip_address: str + :ivar private_ip_address: Private IP Address of this ComputeInstance (local to the VNET in + which the compute instance is deployed). + :vartype private_ip_address: str """ _validation = { - "mode": {"required": True}, - "value": {"required": True}, + "public_ip_address": {"readonly": True}, + "private_ip_address": {"readonly": True}, } _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, + "public_ip_address": {"key": "publicIpAddress", "type": "str"}, + "private_ip_address": {"key": "privateIpAddress", "type": "str"}, } - def __init__(self, *, value: int, **kwargs: Any) -> None: - """ - :keyword value: [Required] Forecast horizon value. Required. - :paramtype value: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.value = value - + self.public_ip_address = None + self.private_ip_address = None -class JobInput(_serialization.Model): - """Command job definition. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CustomModelJobInput, LiteralJobInput, MLFlowModelJobInput, MLTableJobInput, - TritonModelJobInput, UriFileJobInput, UriFolderJobInput +class ComputeInstanceContainer(_serialization.Model): + """Defines an Aml Instance container. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and - "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar name: Name of the ComputeInstance container. + :vartype name: str + :ivar autosave: Auto save settings. Known values are: "None", "Local", and "Remote". + :vartype autosave: str or ~azure.mgmt.machinelearningservices.models.Autosave + :ivar gpu: Information of GPU. + :vartype gpu: str + :ivar network: network of this container. Known values are: "Bridge" and "Host". + :vartype network: str or ~azure.mgmt.machinelearningservices.models.Network + :ivar environment: Environment information of this container. + :vartype environment: ~azure.mgmt.machinelearningservices.models.ComputeInstanceEnvironmentInfo + :ivar services: services of this containers. + :vartype services: list[JSON] """ _validation = { - "job_input_type": {"required": True}, + "services": {"readonly": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - } - - _subtype_map = { - "job_input_type": { - "custom_model": "CustomModelJobInput", - "literal": "LiteralJobInput", - "mlflow_model": "MLFlowModelJobInput", - "mltable": "MLTableJobInput", - "triton_model": "TritonModelJobInput", - "uri_file": "UriFileJobInput", - "uri_folder": "UriFolderJobInput", - } - } - - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: Description for the input. - :paramtype description: str - """ - super().__init__(**kwargs) - self.description = description - self.job_input_type: Optional[str] = None - - -class CustomModelJobInput(AssetJobInput, JobInput): - """CustomModelJobInput. - - All required parameters must be populated in order to send to Azure. - - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and - "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: [Required] Input Asset URI. Required. - :vartype uri: str - """ - - _validation = { - "job_input_type": {"required": True}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - } - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "autosave": {"key": "autosave", "type": "str"}, + "gpu": {"key": "gpu", "type": "str"}, + "network": {"key": "network", "type": "str"}, + "environment": {"key": "environment", "type": "ComputeInstanceEnvironmentInfo"}, + "services": {"key": "services", "type": "[object]"}, } def __init__( self, *, - uri: str, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + name: Optional[str] = None, + autosave: Optional[Union[str, "_models.Autosave"]] = None, + gpu: Optional[str] = None, + network: Optional[Union[str, "_models.Network"]] = None, + environment: Optional["_models.ComputeInstanceEnvironmentInfo"] = None, **kwargs: Any ) -> None: """ - :keyword description: Description for the input. - :paramtype description: str - :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: [Required] Input Asset URI. Required. - :paramtype uri: str + :keyword name: Name of the ComputeInstance container. + :paramtype name: str + :keyword autosave: Auto save settings. Known values are: "None", "Local", and "Remote". + :paramtype autosave: str or ~azure.mgmt.machinelearningservices.models.Autosave + :keyword gpu: Information of GPU. + :paramtype gpu: str + :keyword network: network of this container. Known values are: "Bridge" and "Host". + :paramtype network: str or ~azure.mgmt.machinelearningservices.models.Network + :keyword environment: Environment information of this container. + :paramtype environment: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceEnvironmentInfo """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) - self.description = description - self.job_input_type: str = "custom_model" - self.mode = mode - self.uri = uri - + super().__init__(**kwargs) + self.name = name + self.autosave = autosave + self.gpu = gpu + self.network = network + self.environment = environment + self.services = None -class JobOutput(_serialization.Model): - """Job output definition container information on where to find job output/logs. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - CustomModelJobOutput, MLFlowModelJobOutput, MLTableJobOutput, TritonModelJobOutput, - UriFileJobOutput, UriFolderJobOutput +class ComputeInstanceCreatedBy(_serialization.Model): + """Describes information on user who created this ComputeInstance. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Description for the output. - :vartype description: str - :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 user_name: Name of the user. + :vartype user_name: str + :ivar user_org_id: Uniquely identifies user' Azure Active Directory organization. + :vartype user_org_id: str + :ivar user_id: Uniquely identifies the user within his/her organization. + :vartype user_id: str """ _validation = { - "job_output_type": {"required": True}, + "user_name": {"readonly": True}, + "user_org_id": {"readonly": True}, + "user_id": {"readonly": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - } - - _subtype_map = { - "job_output_type": { - "custom_model": "CustomModelJobOutput", - "mlflow_model": "MLFlowModelJobOutput", - "mltable": "MLTableJobOutput", - "triton_model": "TritonModelJobOutput", - "uri_file": "UriFileJobOutput", - "uri_folder": "UriFolderJobOutput", - } + "user_name": {"key": "userName", "type": "str"}, + "user_org_id": {"key": "userOrgId", "type": "str"}, + "user_id": {"key": "userId", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: Description for the output. - :paramtype description: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.description = description - self.job_output_type: Optional[str] = None - + self.user_name = None + self.user_org_id = None + self.user_id = None -class CustomModelJobOutput(AssetJobOutput, JobOutput): - """CustomModelJobOutput. - All required parameters must be populated in order to send to Azure. +class ComputeInstanceDataDisk(_serialization.Model): + """Defines an Aml Instance DataDisk. - :ivar description: Description for the output. - :vartype description: str - :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". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str + :ivar caching: Caching type of Data Disk. Known values are: "None", "ReadOnly", and + "ReadWrite". + :vartype caching: str or ~azure.mgmt.machinelearningservices.models.Caching + :ivar disk_size_gb: The initial disk size in gigabytes. + :vartype disk_size_gb: int + :ivar lun: The lun is used to uniquely identify each data disk. If attaching multiple disks, + each should have a distinct lun. + :vartype lun: int + :ivar storage_account_type: type of this storage account. Known values are: "Standard_LRS" and + "Premium_LRS". + :vartype storage_account_type: str or + ~azure.mgmt.machinelearningservices.models.StorageAccountType """ - _validation = { - "job_output_type": {"required": True}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "caching": {"key": "caching", "type": "str"}, + "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, + "lun": {"key": "lun", "type": "int"}, + "storage_account_type": {"key": "storageAccountType", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, - uri: Optional[str] = None, + caching: Optional[Union[str, "_models.Caching"]] = None, + disk_size_gb: Optional[int] = None, + lun: Optional[int] = None, + storage_account_type: Union[str, "_models.StorageAccountType"] = "Standard_LRS", **kwargs: Any ) -> None: """ - :keyword description: Description for the output. - :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :keyword uri: Output Asset URI. - :paramtype uri: str + :keyword caching: Caching type of Data Disk. Known values are: "None", "ReadOnly", and + "ReadWrite". + :paramtype caching: str or ~azure.mgmt.machinelearningservices.models.Caching + :keyword disk_size_gb: The initial disk size in gigabytes. + :paramtype disk_size_gb: int + :keyword lun: The lun is used to uniquely identify each data disk. If attaching multiple disks, + each should have a distinct lun. + :paramtype lun: int + :keyword storage_account_type: type of this storage account. Known values are: "Standard_LRS" + and "Premium_LRS". + :paramtype storage_account_type: str or + ~azure.mgmt.machinelearningservices.models.StorageAccountType """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) - self.description = description - self.job_output_type: str = "custom_model" - self.mode = mode - self.uri = uri - + super().__init__(**kwargs) + self.caching = caching + self.disk_size_gb = disk_size_gb + self.lun = lun + self.storage_account_type = storage_account_type -class CustomNCrossValidations(NCrossValidations): - """N-Cross validations are specified by user. - All required parameters must be populated in order to send to Azure. +class ComputeInstanceDataMount(_serialization.Model): + """Defines an Aml Instance DataMount. - :ivar mode: [Required] Mode for determining N-Cross validations. Required. Known values are: - "Auto" and "Custom". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.NCrossValidationsMode - :ivar value: [Required] N-Cross validations value. Required. - :vartype value: int + :ivar source: Source of the ComputeInstance data mount. + :vartype source: str + :ivar source_type: Data source type. Known values are: "Dataset", "Datastore", and "URI". + :vartype source_type: str or ~azure.mgmt.machinelearningservices.models.SourceType + :ivar mount_name: name of the ComputeInstance data mount. + :vartype mount_name: str + :ivar mount_action: Mount Action. Known values are: "Mount" and "Unmount". + :vartype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :ivar mount_mode: Mount Mode. Known values are: "ReadOnly" and "ReadWrite". + :vartype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode + :ivar created_by: who this data mount created by. + :vartype created_by: str + :ivar mount_path: Path of this data mount. + :vartype mount_path: str + :ivar mount_state: Mount state. Known values are: "MountRequested", "Mounted", "MountFailed", + "UnmountRequested", "UnmountFailed", and "Unmounted". + :vartype mount_state: str or ~azure.mgmt.machinelearningservices.models.MountState + :ivar mounted_on: The time when the disk mounted. + :vartype mounted_on: ~datetime.datetime + :ivar error: Error of this data mount. + :vartype error: str """ - _validation = { - "mode": {"required": True}, - "value": {"required": True}, + _attribute_map = { + "source": {"key": "source", "type": "str"}, + "source_type": {"key": "sourceType", "type": "str"}, + "mount_name": {"key": "mountName", "type": "str"}, + "mount_action": {"key": "mountAction", "type": "str"}, + "mount_mode": {"key": "mountMode", "type": "str"}, + "created_by": {"key": "createdBy", "type": "str"}, + "mount_path": {"key": "mountPath", "type": "str"}, + "mount_state": {"key": "mountState", "type": "str"}, + "mounted_on": {"key": "mountedOn", "type": "iso-8601"}, + "error": {"key": "error", "type": "str"}, } - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, - } - - def __init__(self, *, value: int, **kwargs: Any) -> None: + def __init__( + self, + *, + source: Optional[str] = None, + source_type: Optional[Union[str, "_models.SourceType"]] = None, + mount_name: Optional[str] = None, + mount_action: Optional[Union[str, "_models.MountAction"]] = None, + mount_mode: Optional[Union[str, "_models.MountMode"]] = None, + created_by: Optional[str] = None, + mount_path: Optional[str] = None, + mount_state: Optional[Union[str, "_models.MountState"]] = None, + mounted_on: Optional[datetime.datetime] = None, + error: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: [Required] N-Cross validations value. Required. - :paramtype value: int + :keyword source: Source of the ComputeInstance data mount. + :paramtype source: str + :keyword source_type: Data source type. Known values are: "Dataset", "Datastore", and "URI". + :paramtype source_type: str or ~azure.mgmt.machinelearningservices.models.SourceType + :keyword mount_name: name of the ComputeInstance data mount. + :paramtype mount_name: str + :keyword mount_action: Mount Action. Known values are: "Mount" and "Unmount". + :paramtype mount_action: str or ~azure.mgmt.machinelearningservices.models.MountAction + :keyword mount_mode: Mount Mode. Known values are: "ReadOnly" and "ReadWrite". + :paramtype mount_mode: str or ~azure.mgmt.machinelearningservices.models.MountMode + :keyword created_by: who this data mount created by. + :paramtype created_by: str + :keyword mount_path: Path of this data mount. + :paramtype mount_path: str + :keyword mount_state: Mount state. Known values are: "MountRequested", "Mounted", + "MountFailed", "UnmountRequested", "UnmountFailed", and "Unmounted". + :paramtype mount_state: str or ~azure.mgmt.machinelearningservices.models.MountState + :keyword mounted_on: The time when the disk mounted. + :paramtype mounted_on: ~datetime.datetime + :keyword error: Error of this data mount. + :paramtype error: str """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.value = value - + self.source = source + self.source_type = source_type + self.mount_name = mount_name + self.mount_action = mount_action + self.mount_mode = mount_mode + self.created_by = created_by + self.mount_path = mount_path + self.mount_state = mount_state + self.mounted_on = mounted_on + self.error = error -class CustomSeasonality(Seasonality): - """CustomSeasonality. - All required parameters must be populated in order to send to Azure. +class ComputeInstanceEnvironmentInfo(_serialization.Model): + """Environment information. - :ivar mode: [Required] Seasonality mode. Required. Known values are: "Auto" and "Custom". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.SeasonalityMode - :ivar value: [Required] Seasonality value. Required. - :vartype value: int + :ivar name: name of environment. + :vartype name: str + :ivar version: version of environment. + :vartype version: str """ - _validation = { - "mode": {"required": True}, - "value": {"required": True}, - } - _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, } - def __init__(self, *, value: int, **kwargs: Any) -> None: + def __init__(self, *, name: Optional[str] = None, version: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: [Required] Seasonality value. Required. - :paramtype value: int + :keyword name: name of environment. + :paramtype name: str + :keyword version: version of environment. + :paramtype version: str """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.value = value + self.name = name + self.version = version -class CustomService(_serialization.Model): - """Specifies the custom service configuration. +class ComputeInstanceLastOperation(_serialization.Model): + """The last operation on ComputeInstance. - :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] + :ivar operation_name: Name of the last operation. Known values are: "Create", "Start", "Stop", + "Restart", "Resize", "Reimage", and "Delete". + :vartype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName + :ivar operation_time: Time of the last operation. + :vartype operation_time: ~datetime.datetime + :ivar operation_status: Operation status. Known values are: "InProgress", "Succeeded", + "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", "ReimageFailed", + and "DeleteFailed". + :vartype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus + :ivar operation_trigger: Trigger of operation. Known values are: "User", "Schedule", and + "IdleShutdown". + :vartype operation_trigger: str or ~azure.mgmt.machinelearningservices.models.OperationTrigger """ _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]"}, + "operation_name": {"key": "operationName", "type": "str"}, + "operation_time": {"key": "operationTime", "type": "iso-8601"}, + "operation_status": {"key": "operationStatus", "type": "str"}, + "operation_trigger": {"key": "operationTrigger", "type": "str"}, } 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, + operation_name: Optional[Union[str, "_models.OperationName"]] = None, + operation_time: Optional[datetime.datetime] = None, + operation_status: Optional[Union[str, "_models.OperationStatus"]] = None, + operation_trigger: Optional[Union[str, "_models.OperationTrigger"]] = None, **kwargs: Any ) -> None: """ - :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] + :keyword operation_name: Name of the last operation. Known values are: "Create", "Start", + "Stop", "Restart", "Resize", "Reimage", and "Delete". + :paramtype operation_name: str or ~azure.mgmt.machinelearningservices.models.OperationName + :keyword operation_time: Time of the last operation. + :paramtype operation_time: ~datetime.datetime + :keyword operation_status: Operation status. Known values are: "InProgress", "Succeeded", + "CreateFailed", "StartFailed", "StopFailed", "RestartFailed", "ResizeFailed", "ReimageFailed", + and "DeleteFailed". + :paramtype operation_status: str or ~azure.mgmt.machinelearningservices.models.OperationStatus + :keyword operation_trigger: Trigger of operation. Known values are: "User", "Schedule", and + "IdleShutdown". + :paramtype operation_trigger: str or + ~azure.mgmt.machinelearningservices.models.OperationTrigger """ 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 + self.operation_name = operation_name + self.operation_time = operation_time + self.operation_status = operation_status + self.operation_trigger = operation_trigger -class CustomTargetLags(TargetLags): - """CustomTargetLags. +class ComputeInstanceProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Compute Instance properties. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar mode: [Required] Set target lags mode - Auto/Custom. Required. Known values are: "Auto" - and "Custom". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.TargetLagsMode - :ivar values: [Required] Set target lags values. Required. - :vartype values: list[int] + :ivar vm_size: Virtual Machine Size. + :vartype vm_size: str + :ivar subnet: Virtual network subnet resource ID the compute nodes belong to. + :vartype subnet: ~azure.mgmt.machinelearningservices.models.ResourceId + :ivar application_sharing_policy: Policy for sharing applications on this compute instance + among users of parent workspace. If Personal, only the creator can access applications on this + compute instance. When Shared, any workspace user can access applications on this instance + 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: + ~azure.mgmt.machinelearningservices.models.ComputeInstanceConnectivityEndpoints + :ivar applications: Describes available applications and their endpoints on this + ComputeInstance. + :vartype applications: + list[~azure.mgmt.machinelearningservices.models.ComputeInstanceApplication] + :ivar created_by: Describes information on user who created this ComputeInstance. + :vartype created_by: ~azure.mgmt.machinelearningservices.models.ComputeInstanceCreatedBy + :ivar errors: Collection of errors encountered on this ComputeInstance. + :vartype errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar state: The current state of this ComputeInstance. Known values are: "Creating", + "CreateFailed", "Deleting", "Running", "Restarting", "Resizing", "JobRunning", "SettingUp", + "SetupFailed", "Starting", "Stopped", "Stopping", "UserSettingUp", "UserSetupFailed", + "Unknown", and "Unusable". + :vartype state: str or ~azure.mgmt.machinelearningservices.models.ComputeInstanceState + :ivar compute_instance_authorization_type: The Compute Instance Authorization type. Available + values are personal (default). "personal" + :vartype compute_instance_authorization_type: str or + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :ivar enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :vartype enable_os_patching: bool + :ivar enable_root_access: Enable root access. Possible values are: true, false. + :vartype enable_root_access: bool + :ivar enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :vartype enable_sso: bool + :ivar release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :vartype release_quota_on_stop: bool + :ivar personal_compute_instance_settings: Settings for a personal compute instance. + :vartype personal_compute_instance_settings: + ~azure.mgmt.machinelearningservices.models.PersonalComputeInstanceSettings + :ivar setup_scripts: Details of customized scripts to execute for setting up the cluster. + :vartype setup_scripts: ~azure.mgmt.machinelearningservices.models.SetupScripts + :ivar last_operation: The last operation on ComputeInstance. + :vartype last_operation: + ~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 + public IPs. + :vartype enable_node_public_ip: bool + :ivar containers: Describes informations of containers on this ComputeInstance. + :vartype containers: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceContainer] + :ivar data_disks: Describes informations of dataDisks on this ComputeInstance. + :vartype data_disks: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataDisk] + :ivar data_mounts: Describes informations of dataMounts on this ComputeInstance. + :vartype data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] + :ivar versions: ComputeInstance version. + :vartype versions: ~azure.mgmt.machinelearningservices.models.ComputeInstanceVersion """ _validation = { - "mode": {"required": True}, - "values": {"required": True}, + "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}, + "containers": {"readonly": True}, + "data_disks": {"readonly": True}, + "data_mounts": {"readonly": True}, + "versions": {"readonly": True}, } _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "values": {"key": "values", "type": "[int]"}, + "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"}, + "errors": {"key": "errors", "type": "[ErrorResponse]"}, + "state": {"key": "state", "type": "str"}, + "compute_instance_authorization_type": {"key": "computeInstanceAuthorizationType", "type": "str"}, + "enable_os_patching": {"key": "enableOSPatching", "type": "bool"}, + "enable_root_access": {"key": "enableRootAccess", "type": "bool"}, + "enable_sso": {"key": "enableSSO", "type": "bool"}, + "release_quota_on_stop": {"key": "releaseQuotaOnStop", "type": "bool"}, + "personal_compute_instance_settings": { + "key": "personalComputeInstanceSettings", + "type": "PersonalComputeInstanceSettings", + }, + "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]"}, + "data_mounts": {"key": "dataMounts", "type": "[ComputeInstanceDataMount]"}, + "versions": {"key": "versions", "type": "ComputeInstanceVersion"}, } - def __init__(self, *, values: List[int], **kwargs: Any) -> None: + def __init__( # pylint: disable=too-many-locals + self, + *, + 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", + enable_os_patching: bool = False, + enable_root_access: bool = True, + enable_sso: bool = True, + release_quota_on_stop: bool = False, + 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: Any + ) -> None: """ - :keyword values: [Required] Set target lags values. Required. - :paramtype values: list[int] + :keyword vm_size: Virtual Machine Size. + :paramtype vm_size: str + :keyword subnet: Virtual network subnet resource ID the compute nodes belong to. + :paramtype subnet: ~azure.mgmt.machinelearningservices.models.ResourceId + :keyword application_sharing_policy: Policy for sharing applications on this compute instance + among users of parent workspace. If Personal, only the creator can access applications on this + compute instance. When Shared, any workspace user can access applications on this instance + 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 + ~azure.mgmt.machinelearningservices.models.ComputeInstanceAuthorizationType + :keyword enable_os_patching: Enable Auto OS Patching. Possible values are: true, false. + :paramtype enable_os_patching: bool + :keyword enable_root_access: Enable root access. Possible values are: true, false. + :paramtype enable_root_access: bool + :keyword enable_sso: Enable SSO (single sign on). Possible values are: true, false. + :paramtype enable_sso: bool + :keyword release_quota_on_stop: Release quota if compute instance stopped. Possible values are: + true - release quota if compute instance stopped. false - don't release quota when compute + instance stopped. + :paramtype release_quota_on_stop: bool + :keyword personal_compute_instance_settings: Settings for a personal compute instance. + :paramtype personal_compute_instance_settings: + ~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 + public IPs. + :paramtype enable_node_public_ip: bool """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.values = values + 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 + self.errors = None + self.state = None + self.compute_instance_authorization_type = compute_instance_authorization_type + self.enable_os_patching = enable_os_patching + self.enable_root_access = enable_root_access + self.enable_sso = enable_sso + self.release_quota_on_stop = release_quota_on_stop + self.personal_compute_instance_settings = personal_compute_instance_settings + self.setup_scripts = setup_scripts + self.last_operation = 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 + self.data_mounts = None + self.versions = None -class CustomTargetRollingWindowSize(TargetRollingWindowSize): - """CustomTargetRollingWindowSize. +class ComputeInstanceSshSettings(_serialization.Model): + """Specifies policy and settings for SSH access. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar mode: [Required] TargetRollingWindowSiz detection mode. Required. Known values are: - "Auto" and "Custom". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSizeMode - :ivar value: [Required] TargetRollingWindowSize value. Required. - :vartype value: int + :ivar ssh_public_access: 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 accessible according to the VNet/subnet policy if applicable. Known + values are: "Enabled" and "Disabled". + :vartype ssh_public_access: str or ~azure.mgmt.machinelearningservices.models.SshPublicAccess + :ivar admin_user_name: Describes the admin user name. + :vartype admin_user_name: str + :ivar ssh_port: Describes the port for connecting through SSH. + :vartype ssh_port: int + :ivar admin_public_key: Specifies the SSH rsa public key file as a string. Use "ssh-keygen -t + rsa -b 2048" to generate your SSH key pairs. + :vartype admin_public_key: str """ _validation = { - "mode": {"required": True}, - "value": {"required": True}, + "admin_user_name": {"readonly": True}, + "ssh_port": {"readonly": True}, } _attribute_map = { - "mode": {"key": "mode", "type": "str"}, - "value": {"key": "value", "type": "int"}, + "ssh_public_access": {"key": "sshPublicAccess", "type": "str"}, + "admin_user_name": {"key": "adminUserName", "type": "str"}, + "ssh_port": {"key": "sshPort", "type": "int"}, + "admin_public_key": {"key": "adminPublicKey", "type": "str"}, } - def __init__(self, *, value: int, **kwargs: Any) -> None: + def __init__( + self, + *, + ssh_public_access: Union[str, "_models.SshPublicAccess"] = "Disabled", + admin_public_key: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword value: [Required] TargetRollingWindowSize value. Required. - :paramtype value: int + :keyword ssh_public_access: 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 accessible according to the VNet/subnet policy if applicable. Known + values are: "Enabled" and "Disabled". + :paramtype ssh_public_access: str or ~azure.mgmt.machinelearningservices.models.SshPublicAccess + :keyword admin_public_key: Specifies the SSH rsa public key file as a string. Use "ssh-keygen + -t rsa -b 2048" to generate your SSH key pairs. + :paramtype admin_public_key: str """ super().__init__(**kwargs) - self.mode: str = "Custom" - self.value = value + self.ssh_public_access = ssh_public_access + self.admin_user_name = None + self.ssh_port = None + self.admin_public_key = admin_public_key -class DatabricksSchema(_serialization.Model): - """DatabricksSchema. +class ComputeInstanceVersion(_serialization.Model): + """Version of computeInstance. - :ivar properties: Properties of Databricks. - :vartype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties + :ivar runtime: Runtime of compute instance. + :vartype runtime: str """ _attribute_map = { - "properties": {"key": "properties", "type": "DatabricksProperties"}, + "runtime": {"key": "runtime", "type": "str"}, } - def __init__(self, *, properties: Optional["_models.DatabricksProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, runtime: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword properties: Properties of Databricks. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties + :keyword runtime: Runtime of compute instance. + :paramtype runtime: str """ super().__init__(**kwargs) - self.properties = properties - + self.runtime = runtime -class Databricks(Compute, DatabricksSchema): # pylint: disable=too-many-instance-attributes - """A DataFactory compute. - Variables are only populated by the server, and will be ignored when sending a request. +class ComputeRecurrenceSchedule(_serialization.Model): + """ComputeRecurrenceSchedule. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar properties: Properties of Databricks. - :vartype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties - :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 - :ivar compute_location: Location for the underlying 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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar hours: [Required] List of hours for the schedule. Required. + :vartype hours: list[int] + :ivar minutes: [Required] List of minutes for the schedule. Required. + :vartype minutes: list[int] + :ivar month_days: List of month days for the schedule. + :vartype month_days: list[int] + :ivar week_days: List of days for the schedule. + :vartype week_days: list[str or ~azure.mgmt.machinelearningservices.models.ComputeWeekDay] """ _validation = { - "compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, + "hours": {"required": True}, + "minutes": {"required": True}, } _attribute_map = { - "properties": {"key": "properties", "type": "DatabricksProperties"}, - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "hours": {"key": "hours", "type": "[int]"}, + "minutes": {"key": "minutes", "type": "[int]"}, + "month_days": {"key": "monthDays", "type": "[int]"}, + "week_days": {"key": "weekDays", "type": "[str]"}, } def __init__( self, *, - properties: Optional["_models.DatabricksProperties"] = None, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, + hours: List[int], + minutes: List[int], + month_days: Optional[List[int]] = None, + week_days: Optional[List[Union[str, "_models.ComputeWeekDay"]]] = None, **kwargs: Any ) -> None: """ - :keyword properties: Properties of Databricks. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool - """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - properties=properties, - **kwargs - ) - self.properties = properties - self.compute_type: str = "Databricks" - self.compute_location = compute_location - self.provisioning_state = None - self.description = description - self.created_on = None - self.modified_on = None - self.resource_id = resource_id - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = disable_local_auth - - -class DatabricksComputeSecretsProperties(_serialization.Model): - """Properties of Databricks Compute Secrets. - - :ivar databricks_access_token: access token for databricks account. - :vartype databricks_access_token: str - """ - - _attribute_map = { - "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, - } - - def __init__(self, *, databricks_access_token: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword databricks_access_token: access token for databricks account. - :paramtype databricks_access_token: str + :keyword hours: [Required] List of hours for the schedule. Required. + :paramtype hours: list[int] + :keyword minutes: [Required] List of minutes for the schedule. Required. + :paramtype minutes: list[int] + :keyword month_days: List of month days for the schedule. + :paramtype month_days: list[int] + :keyword week_days: List of days for the schedule. + :paramtype week_days: list[str or ~azure.mgmt.machinelearningservices.models.ComputeWeekDay] """ super().__init__(**kwargs) - self.databricks_access_token = databricks_access_token - - -class DatabricksComputeSecrets(ComputeSecrets, DatabricksComputeSecretsProperties): - """Secrets related to a Machine Learning compute based on Databricks. - - All required parameters must be populated in order to send to Azure. - - :ivar databricks_access_token: access token for databricks account. - :vartype databricks_access_token: str - :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 - """ - - _validation = { - "compute_type": {"required": True}, - } - - _attribute_map = { - "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, - "compute_type": {"key": "computeType", "type": "str"}, - } - - def __init__(self, *, databricks_access_token: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword databricks_access_token: access token for databricks account. - :paramtype databricks_access_token: str - """ - super().__init__(databricks_access_token=databricks_access_token, **kwargs) - self.databricks_access_token = databricks_access_token - self.compute_type: str = "Databricks" + self.hours = hours + self.minutes = minutes + self.month_days = month_days + self.week_days = week_days -class DatabricksProperties(_serialization.Model): - """Properties of Databricks. +class ComputeResourceSchema(_serialization.Model): + """ComputeResourceSchema. - :ivar databricks_access_token: Databricks access token. - :vartype databricks_access_token: str - :ivar workspace_url: Workspace Url. - :vartype workspace_url: str + :ivar properties: Compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.Compute """ _attribute_map = { - "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, - "workspace_url": {"key": "workspaceUrl", "type": "str"}, + "properties": {"key": "properties", "type": "Compute"}, } - def __init__( - self, *, databricks_access_token: Optional[str] = None, workspace_url: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.Compute"] = None, **kwargs: Any) -> None: """ - :keyword databricks_access_token: Databricks access token. - :paramtype databricks_access_token: str - :keyword workspace_url: Workspace Url. - :paramtype workspace_url: str + :keyword properties: Compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.Compute """ super().__init__(**kwargs) - self.databricks_access_token = databricks_access_token - self.workspace_url = workspace_url + self.properties = properties -class DataContainer(Resource): - """Azure Resource Manager resource envelope. +class ComputeResource(Resource, ComputeResourceSchema): + """Machine Learning compute object wrapped into ARM resource envelope. 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: Compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.Compute :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -7259,8 +8451,14 @@ class DataContainer(Resource): :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.DataContainerProperties + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Specifies the location of the resource. + :vartype location: str + :ivar tags: Contains resource tags defined as key/value pairs. + :vartype tags: dict[str, str] + :ivar sku: The sku of the workspace. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { @@ -7268,1437 +8466,2064 @@ class DataContainer(Resource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "properties": {"required": True}, } _attribute_map = { + "properties": {"key": "properties", "type": "Compute"}, "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": "DataContainerProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "location": {"key": "location", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "Sku"}, } - def __init__(self, *, properties: "_models.DataContainerProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + properties: Optional["_models.Compute"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataContainerProperties + :keyword properties: Compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.Compute + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Specifies the location of the resource. + :paramtype location: str + :keyword tags: Contains resource tags defined as key/value pairs. + :paramtype tags: dict[str, str] + :keyword sku: The sku of the workspace. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super().__init__(**kwargs) + super().__init__(properties=properties, **kwargs) self.properties = properties + self.identity = identity + self.location = location + self.tags = tags + self.sku = sku + self.id = None + self.name = None + self.type = None + self.system_data = None -class DataContainerProperties(AssetContainer): - """Container for data asset versions. - - 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. +class ComputeRuntimeDto(_serialization.Model): + """ComputeRuntimeDto. - :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 is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar latest_version: The latest version inside this container. - :vartype latest_version: str - :ivar next_version: The next auto incremental version. - :vartype next_version: str - :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 spark_runtime_version: + :vartype spark_runtime_version: str """ - _validation = { - "latest_version": {"readonly": True}, - "next_version": {"readonly": True}, - "data_type": {"required": True}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "latest_version": {"key": "latestVersion", "type": "str"}, - "next_version": {"key": "nextVersion", "type": "str"}, - "data_type": {"key": "dataType", "type": "str"}, + "spark_runtime_version": {"key": "sparkRuntimeVersion", "type": "str"}, } - def __init__( - self, - *, - data_type: Union[str, "_models.DataType"], - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_archived: bool = False, - **kwargs: Any - ) -> None: + def __init__(self, *, spark_runtime_version: Optional[str] = None, **kwargs: Any) -> None: """ - :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 is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword data_type: [Required] Specifies the type of data. Required. Known values are: - "uri_file", "uri_folder", and "mltable". - :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType + :keyword spark_runtime_version: + :paramtype spark_runtime_version: str """ - super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.data_type = data_type + super().__init__(**kwargs) + self.spark_runtime_version = spark_runtime_version -class DataContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of DataContainer entities. +class ComputeSchedules(_serialization.Model): + """The list of schedules to be applied on the computes. - :ivar next_link: The link to the next page of DataContainer objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type DataContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.DataContainer] + :ivar compute_start_stop: The list of compute start stop schedules to be applied. + :vartype compute_start_stop: + list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DataContainer]"}, + "compute_start_stop": {"key": "computeStartStop", "type": "[ComputeStartStopSchedule]"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataContainer"]] = None, **kwargs: Any + self, *, compute_start_stop: Optional[List["_models.ComputeStartStopSchedule"]] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of DataContainer objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type DataContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.DataContainer] + :keyword compute_start_stop: The list of compute start stop schedules to be applied. + :paramtype compute_start_stop: + list[~azure.mgmt.machinelearningservices.models.ComputeStartStopSchedule] """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.compute_start_stop = compute_start_stop -class DataFactory(Compute): - """A DataFactory compute. +class ComputeStartStopSchedule(_serialization.Model): + """Compute start stop schedule properties. 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 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 - :ivar compute_location: Location for the underlying 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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar id: A system assigned id for the schedule. + :vartype id: str + :ivar provisioning_status: The current deployment state of schedule. Known values are: + "Completed", "Provisioning", and "Failed". + :vartype provisioning_status: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningStatus + :ivar status: Is the schedule enabled or disabled?. Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus + :ivar action: [Required] The compute power action. Known values are: "Start" and "Stop". + :vartype action: str or ~azure.mgmt.machinelearningservices.models.ComputePowerAction + :ivar trigger_type: [Required] The schedule trigger type. Known values are: "Recurrence" and + "Cron". + :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.ComputeTriggerType + :ivar recurrence: Required if triggerType is Recurrence. + :vartype recurrence: ~azure.mgmt.machinelearningservices.models.Recurrence + :ivar cron: Required if triggerType is Cron. + :vartype cron: ~azure.mgmt.machinelearningservices.models.Cron + :ivar schedule: [Deprecated] Not used any more. + :vartype schedule: ~azure.mgmt.machinelearningservices.models.ScheduleBase """ _validation = { - "compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, + "id": {"readonly": True}, + "provisioning_status": {"readonly": True}, } _attribute_map = { - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "id": {"key": "id", "type": "str"}, + "provisioning_status": {"key": "provisioningStatus", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "action": {"key": "action", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "recurrence": {"key": "recurrence", "type": "Recurrence"}, + "cron": {"key": "cron", "type": "Cron"}, + "schedule": {"key": "schedule", "type": "ScheduleBase"}, } def __init__( self, *, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, + status: Optional[Union[str, "_models.ScheduleStatus"]] = None, + action: Optional[Union[str, "_models.ComputePowerAction"]] = None, + trigger_type: Optional[Union[str, "_models.ComputeTriggerType"]] = None, + recurrence: Optional["_models.Recurrence"] = None, + cron: Optional["_models.Cron"] = None, + schedule: Optional["_models.ScheduleBase"] = None, **kwargs: Any ) -> None: """ - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool + :keyword status: Is the schedule enabled or disabled?. Known values are: "Enabled" and + "Disabled". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus + :keyword action: [Required] The compute power action. Known values are: "Start" and "Stop". + :paramtype action: str or ~azure.mgmt.machinelearningservices.models.ComputePowerAction + :keyword trigger_type: [Required] The schedule trigger type. Known values are: "Recurrence" and + "Cron". + :paramtype trigger_type: str or ~azure.mgmt.machinelearningservices.models.ComputeTriggerType + :keyword recurrence: Required if triggerType is Recurrence. + :paramtype recurrence: ~azure.mgmt.machinelearningservices.models.Recurrence + :keyword cron: Required if triggerType is Cron. + :paramtype cron: ~azure.mgmt.machinelearningservices.models.Cron + :keyword schedule: [Deprecated] Not used any more. + :paramtype schedule: ~azure.mgmt.machinelearningservices.models.ScheduleBase """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - **kwargs - ) - self.compute_type: str = "DataFactory" + super().__init__(**kwargs) + self.id = None + self.provisioning_status = None + self.status = status + self.action = action + self.trigger_type = trigger_type + self.recurrence = recurrence + self.cron = cron + self.schedule = schedule -class DataLakeAnalyticsSchema(_serialization.Model): - """DataLakeAnalyticsSchema. +class ContainerResourceRequirements(_serialization.Model): + """Resource requirements for each container instance within an online deployment. - :ivar properties: - :vartype properties: - ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + :ivar container_resource_limits: Container resource limit info:. + :vartype container_resource_limits: + ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings + :ivar container_resource_requests: Container resource request info:. + :vartype container_resource_requests: + ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings """ _attribute_map = { - "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, + "container_resource_limits": {"key": "containerResourceLimits", "type": "ContainerResourceSettings"}, + "container_resource_requests": {"key": "containerResourceRequests", "type": "ContainerResourceSettings"}, } def __init__( - self, *, properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, **kwargs: Any + self, + *, + container_resource_limits: Optional["_models.ContainerResourceSettings"] = None, + container_resource_requests: Optional["_models.ContainerResourceSettings"] = None, + **kwargs: Any ) -> None: """ - :keyword properties: - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + :keyword container_resource_limits: Container resource limit info:. + :paramtype container_resource_limits: + ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings + :keyword container_resource_requests: Container resource request info:. + :paramtype container_resource_requests: + ~azure.mgmt.machinelearningservices.models.ContainerResourceSettings """ super().__init__(**kwargs) - self.properties = properties + self.container_resource_limits = container_resource_limits + self.container_resource_requests = container_resource_requests -class DataLakeAnalytics(Compute, DataLakeAnalyticsSchema): # pylint: disable=too-many-instance-attributes - """A DataLakeAnalytics compute. +class ContainerResourceSettings(_serialization.Model): + """ContainerResourceSettings. + + :ivar cpu: Number of vCPUs request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :vartype cpu: str + :ivar gpu: Number of Nvidia GPU cards request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :vartype gpu: str + :ivar memory: Memory size request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :vartype memory: str + """ + + _attribute_map = { + "cpu": {"key": "cpu", "type": "str"}, + "gpu": {"key": "gpu", "type": "str"}, + "memory": {"key": "memory", "type": "str"}, + } + + def __init__( + self, *, cpu: Optional[str] = None, gpu: Optional[str] = None, memory: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword cpu: Number of vCPUs request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :paramtype cpu: str + :keyword gpu: Number of Nvidia GPU cards request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :paramtype gpu: str + :keyword memory: Memory size request/limit for container. More info: + https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/. + :paramtype memory: str + """ + super().__init__(**kwargs) + self.cpu = cpu + self.gpu = gpu + self.memory = memory + + +class ContentSafety(_serialization.Model): + """ContentSafety. + + All required parameters must be populated in order to send to server. + + :ivar content_safety_status: [Required] Specifies the status of content safety. Required. Known + values are: "Enabled" and "Disabled". + :vartype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + + _validation = { + "content_safety_status": {"required": True}, + } + + _attribute_map = { + "content_safety_status": {"key": "contentSafetyStatus", "type": "str"}, + } + + def __init__(self, *, content_safety_status: Union[str, "_models.ContentSafetyStatus"], **kwargs: Any) -> None: + """ + :keyword content_safety_status: [Required] Specifies the status of content safety. Required. + Known values are: "Enabled" and "Disabled". + :paramtype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus + """ + super().__init__(**kwargs) + self.content_safety_status = content_safety_status + + +class EndpointDeploymentResourceProperties(_serialization.Model): + """EndpointDeploymentResourceProperties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContentSafetyEndpointDeploymentResourceProperties, OpenAIEndpointDeploymentResourceProperties, + SpeechEndpointDeploymentResourceProperties, ManagedOnlineEndpointDeploymentResourceProperties 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. + All required parameters must be populated in order to send to server. - :ivar properties: - :vartype properties: - ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties - :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 - :ivar compute_location: Location for the underlying 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". + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str """ _validation = { - "compute_type": {"required": True}, "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "type": {"key": "type", "type": "str"}, } - def __init__( - self, - *, - properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, - **kwargs: Any - ) -> None: + _subtype_map = { + "type": { + "Azure.ContentSafety": "ContentSafetyEndpointDeploymentResourceProperties", + "Azure.OpenAI": "OpenAIEndpointDeploymentResourceProperties", + "Azure.Speech": "SpeechEndpointDeploymentResourceProperties", + "managedOnlineEndpoint": "ManagedOnlineEndpointDeploymentResourceProperties", + } + } + + def __init__(self, *, failure_reason: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword properties: - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - properties=properties, - **kwargs - ) - self.properties = properties - self.compute_type: str = "DataLakeAnalytics" - self.compute_location = compute_location + super().__init__(**kwargs) + self.failure_reason = failure_reason self.provisioning_state = None - self.description = description - self.created_on = None - self.modified_on = None - self.resource_id = resource_id - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = disable_local_auth + self.type: Optional[str] = None -class DataLakeAnalyticsSchemaProperties(_serialization.Model): - """DataLakeAnalyticsSchemaProperties. +class ContentSafetyEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): # pylint: disable=name-too-long + """ContentSafetyEndpointDeploymentResourceProperties. - :ivar data_lake_store_account_name: DataLake Store Account Name. - :vartype data_lake_store_account_name: str + 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 server. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str + :ivar model: Model used for the endpoint deployment. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar sku: + :vartype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :ivar version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ + _validation = { + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "model": {"required": True}, + } + _attribute_map = { - "data_lake_store_account_name": {"key": "dataLakeStoreAccountName", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "model": {"key": "model", "type": "EndpointDeploymentModel"}, + "rai_policy_name": {"key": "raiPolicyName", "type": "str"}, + "sku": {"key": "sku", "type": "CognitiveServicesSku"}, + "version_upgrade_option": {"key": "versionUpgradeOption", "type": "str"}, } - def __init__(self, *, data_lake_store_account_name: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + model: "_models.EndpointDeploymentModel", + failure_reason: Optional[str] = None, + rai_policy_name: Optional[str] = None, + sku: Optional["_models.CognitiveServicesSku"] = None, + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, + **kwargs: Any + ) -> None: """ - :keyword data_lake_store_account_name: DataLake Store Account Name. - :paramtype data_lake_store_account_name: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword model: Model used for the endpoint deployment. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword sku: + :paramtype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :keyword version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ - super().__init__(**kwargs) - self.data_lake_store_account_name = data_lake_store_account_name + super().__init__( + model=model, + rai_policy_name=rai_policy_name, + sku=sku, + version_upgrade_option=version_upgrade_option, + failure_reason=failure_reason, + **kwargs + ) + self.failure_reason = failure_reason + self.provisioning_state = None + self.type: str = "Azure.ContentSafety" + self.model = model + self.rai_policy_name = rai_policy_name + self.sku = sku + self.version_upgrade_option = version_upgrade_option -class DataPathAssetReference(AssetReferenceBase): - """Reference to an asset via its path in a datastore. +class EndpointResourceProperties(_serialization.Model): + """EndpointResourceProperties. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ContentSafetyEndpointResourceProperties, OpenAIEndpointResourceProperties, + SpeechEndpointResourceProperties, ManagedOnlineEndpointResourceProperties, + ServerlessEndpointResourceProperties - :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values - are: "Id", "DataPath", and "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar datastore_id: ARM resource ID of the datastore where the asset is located. - :vartype datastore_id: str - :ivar path: The path of the file/directory in the datastore. - :vartype path: str + 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 server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - "reference_type": {"required": True}, + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "reference_type": {"key": "referenceType", "type": "str"}, - "datastore_id": {"key": "datastoreId", "type": "str"}, - "path": {"key": "path", "type": "str"}, + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, } - def __init__(self, *, datastore_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + _subtype_map = { + "endpoint_type": { + "Azure.ContentSafety": "ContentSafetyEndpointResourceProperties", + "Azure.OpenAI": "OpenAIEndpointResourceProperties", + "Azure.Speech": "SpeechEndpointResourceProperties", + "managedOnlineEndpoint": "ManagedOnlineEndpointResourceProperties", + "serverlessEndpoint": "ServerlessEndpointResourceProperties", + } + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword datastore_id: ARM resource ID of the datastore where the asset is located. - :paramtype datastore_id: str - :keyword path: The path of the file/directory in the datastore. - :paramtype path: str + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool """ super().__init__(**kwargs) - self.reference_type: str = "DataPath" - self.datastore_id = datastore_id - self.path = path + self.associated_resource_id = associated_resource_id + self.deployments = deployments + self.endpoint_type: Optional[str] = None + self.endpoint_uri = endpoint_uri + self.failure_reason = failure_reason + self.location = location + self.name = name + self.provisioning_state = None + self.should_create_ai_services_endpoint = should_create_ai_services_endpoint -class Datastore(Resource): - """Azure Resource Manager resource envelope. +class ContentSafetyEndpointResourceProperties(EndpointResourceProperties): + """ContentSafetyEndpointResourceProperties. 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. + All required parameters must be populated in order to send to server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. :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.DatastoreProperties + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "DatastoreProperties"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, } - def __init__(self, *, properties: "_models.DatastoreProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatastoreProperties + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool """ - super().__init__(**kwargs) - self.properties = properties + super().__init__( + associated_resource_id=associated_resource_id, + deployments=deployments, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + location=location, + name=name, + should_create_ai_services_endpoint=should_create_ai_services_endpoint, + **kwargs + ) + self.endpoint_type: str = "Azure.ContentSafety" -class DatastoreResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Datastore entities. +class CosmosDbSettings(_serialization.Model): + """CosmosDbSettings. - :ivar next_link: The link to the next page of Datastore objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type Datastore. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Datastore] + :ivar collections_throughput: + :vartype collections_throughput: int """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Datastore]"}, + "collections_throughput": {"key": "collectionsThroughput", "type": "int"}, } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.Datastore"]] = None, **kwargs: Any - ) -> None: + def __init__(self, *, collections_throughput: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword next_link: The link to the next page of Datastore objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type Datastore. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.Datastore] + :keyword collections_throughput: + :paramtype collections_throughput: int """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.collections_throughput = collections_throughput -class DataVersionBase(Resource): - """Azure Resource Manager resource envelope. +class ScheduleActionBase(_serialization.Model): + """ScheduleActionBase. - 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: + JobScheduleAction, CreateMonitorAction, EndpointScheduleAction - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :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.DataVersionBaseProperties + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "action_type": {"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"}, - "properties": {"key": "properties", "type": "DataVersionBaseProperties"}, + "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, properties: "_models.DataVersionBaseProperties", **kwargs: Any) -> None: - """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataVersionBaseProperties - """ + _subtype_map = { + "action_type": { + "CreateJob": "JobScheduleAction", + "CreateMonitor": "CreateMonitorAction", + "InvokeBatchEndpoint": "EndpointScheduleAction", + } + } + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.properties = properties + self.action_type: Optional[str] = None -class DataVersionBaseProperties(AssetBase): - """Data version base definition. +class CreateMonitorAction(ScheduleActionBase): + """CreateMonitorAction. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - MLTableData, UriFileDataVersion, UriFolderDataVersion + All required parameters must be populated in order to send to server. - 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 is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :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. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. Required. - :vartype data_uri: str - """ + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar monitor_definition: [Required] Defines the monitor. Required. + :vartype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition + """ _validation = { - "data_type": {"required": True}, - "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "action_type": {"required": True}, + "monitor_definition": {"required": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_anonymous": {"key": "isAnonymous", "type": "bool"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "data_type": {"key": "dataType", "type": "str"}, - "data_uri": {"key": "dataUri", "type": "str"}, - } - - _subtype_map = { - "data_type": {"mltable": "MLTableData", "uri_file": "UriFileDataVersion", "uri_folder": "UriFolderDataVersion"} + "action_type": {"key": "actionType", "type": "str"}, + "monitor_definition": {"key": "monitorDefinition", "type": "MonitorDefinition"}, } - def __init__( - self, - *, - data_uri: str, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: bool = False, - is_archived: bool = False, - **kwargs: Any - ) -> None: + def __init__(self, *, monitor_definition: "_models.MonitorDefinition", **kwargs: Any) -> None: """ - :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 is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword data_uri: [Required] Uri of the data. Example: - https://go.microsoft.com/fwlink/?linkid=2202330. Required. - :paramtype data_uri: str + :keyword monitor_definition: [Required] Defines the monitor. Required. + :paramtype monitor_definition: ~azure.mgmt.machinelearningservices.models.MonitorDefinition """ - super().__init__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, - **kwargs - ) - self.data_type: Optional[str] = None - self.data_uri = data_uri + super().__init__(**kwargs) + self.action_type: str = "CreateMonitor" + self.monitor_definition = monitor_definition -class DataVersionBaseResourceArmPaginatedResult(_serialization.Model): - """A paginated list of DataVersionBase entities. +class Cron(_serialization.Model): + """The workflow trigger cron for ComputeStartStop schedule type. - :ivar next_link: The link to the next page of DataVersionBase objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type DataVersionBase. - :vartype value: list[~azure.mgmt.machinelearningservices.models.DataVersionBase] + :ivar start_time: The start time in yyyy-MM-ddTHH:mm:ss format. + :vartype start_time: str + :ivar time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :vartype time_zone: str + :ivar expression: [Required] Specifies cron expression of schedule. + The expression should follow NCronTab format. + :vartype expression: str """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[DataVersionBase]"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "expression": {"key": "expression", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataVersionBase"]] = None, **kwargs: Any + self, + *, + start_time: Optional[str] = None, + time_zone: str = "UTC", + expression: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of DataVersionBase objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type DataVersionBase. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.DataVersionBase] + :keyword start_time: The start time in yyyy-MM-ddTHH:mm:ss format. + :paramtype start_time: str + :keyword time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :paramtype time_zone: str + :keyword expression: [Required] Specifies cron expression of schedule. + The expression should follow NCronTab format. + :paramtype expression: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.start_time = start_time + self.time_zone = time_zone + self.expression = expression -class OnlineScaleSettings(_serialization.Model): - """Online deployment scaling configuration. +class TriggerBase(_serialization.Model): + """TriggerBase. You probably want to use the sub-classes and not this class directly. Known sub-classes are: - DefaultScaleSettings, TargetUtilizationScaleSettings + CronTrigger, RecurrenceTrigger - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar scale_type: [Required] Type of deployment scaling algorithm. Required. Known values are: - "Default" and "TargetUtilization". - :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.ScaleType + :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :vartype end_time: str + :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :vartype start_time: str + :ivar time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :vartype time_zone: str + :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". + :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType """ _validation = { - "scale_type": {"required": True}, + "trigger_type": {"required": True}, } _attribute_map = { - "scale_type": {"key": "scaleType", "type": "str"}, + "end_time": {"key": "endTime", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, } - _subtype_map = { - "scale_type": {"Default": "DefaultScaleSettings", "TargetUtilization": "TargetUtilizationScaleSettings"} - } + _subtype_map = {"trigger_type": {"Cron": "CronTrigger", "Recurrence": "RecurrenceTrigger"}} - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, *, end_time: Optional[str] = None, start_time: Optional[str] = None, time_zone: str = "UTC", **kwargs: Any + ) -> None: + """ + :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :paramtype end_time: str + :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :paramtype start_time: str + :keyword time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :paramtype time_zone: str + """ super().__init__(**kwargs) - self.scale_type: Optional[str] = None + self.end_time = end_time + self.start_time = start_time + self.time_zone = time_zone + self.trigger_type: Optional[str] = None -class DefaultScaleSettings(OnlineScaleSettings): - """DefaultScaleSettings. +class CronTrigger(TriggerBase): + """CronTrigger. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar scale_type: [Required] Type of deployment scaling algorithm. Required. Known values are: - "Default" and "TargetUtilization". - :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.ScaleType + :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :vartype end_time: str + :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :vartype start_time: str + :ivar time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :vartype time_zone: str + :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". + :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType + :ivar expression: [Required] Specifies cron expression of schedule. + The expression should follow NCronTab format. Required. + :vartype expression: str """ _validation = { - "scale_type": {"required": True}, + "trigger_type": {"required": True}, + "expression": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "scale_type": {"key": "scaleType", "type": "str"}, + "end_time": {"key": "endTime", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "expression": {"key": "expression", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.scale_type: str = "Default" + def __init__( + self, + *, + expression: str, + end_time: Optional[str] = None, + start_time: Optional[str] = None, + time_zone: str = "UTC", + **kwargs: Any + ) -> None: + """ + :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :paramtype end_time: str + :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :paramtype start_time: str + :keyword time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :paramtype time_zone: str + :keyword expression: [Required] Specifies cron expression of schedule. + The expression should follow NCronTab format. Required. + :paramtype expression: str + """ + super().__init__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) + self.trigger_type: str = "Cron" + self.expression = expression -class DeploymentLogs(_serialization.Model): - """DeploymentLogs. +class CustomForecastHorizon(ForecastHorizon): + """The desired maximum forecast horizon in units of time-series frequency. - :ivar content: The retrieved online deployment logs. - :vartype content: str + All required parameters must be populated in order to send to server. + + :ivar mode: [Required] Set forecast horizon value selection mode. Required. Known values are: + "Auto" and "Custom". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.ForecastHorizonMode + :ivar value: [Required] Forecast horizon value. Required. + :vartype value: int """ + _validation = { + "mode": {"required": True}, + "value": {"required": True}, + } + _attribute_map = { - "content": {"key": "content", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :keyword content: The retrieved online deployment logs. - :paramtype content: str + :keyword value: [Required] Forecast horizon value. Required. + :paramtype value: int """ super().__init__(**kwargs) - self.content = content + self.mode: str = "Custom" + self.value = value -class DeploymentLogsRequest(_serialization.Model): - """DeploymentLogsRequest. +class CustomKeys(_serialization.Model): + """Custom Keys credential object. - :ivar container_type: The type of container to retrieve logs from. Known values are: - "StorageInitializer" and "InferenceServer". - :vartype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType - :ivar tail: The maximum number of lines to tail. - :vartype tail: int + :ivar keys: Dictionary of :code:``. + :vartype keys: dict[str, str] """ _attribute_map = { - "container_type": {"key": "containerType", "type": "str"}, - "tail": {"key": "tail", "type": "int"}, + "keys": {"key": "keys", "type": "{str}"}, } - def __init__( - self, - *, - container_type: Optional[Union[str, "_models.ContainerType"]] = None, - tail: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, keys: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ - :keyword container_type: The type of container to retrieve logs from. Known values are: - "StorageInitializer" and "InferenceServer". - :paramtype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType - :keyword tail: The maximum number of lines to tail. - :paramtype tail: int + :keyword keys: Dictionary of :code:``. + :paramtype keys: dict[str, str] """ super().__init__(**kwargs) - self.container_type = container_type - self.tail = tail + self.keys = keys -class ResourceConfiguration(_serialization.Model): - """ResourceConfiguration. +class CustomKeysWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes + """Category:= CustomKeys + AuthType:= CustomKeys (as type discriminator) + Credentials:= {CustomKeys} as + Microsoft.MachineLearning.AccountRP.Contracts.WorkspaceConnection.CustomKeys + Target:= {any value} + Use Metadata property bag for ApiVersion and other metadata fields. - :ivar instance_count: Optional number of instances or nodes used by the compute target. - :vartype instance_count: int - :ivar instance_type: Optional type of VM used as supported by the compute target. - :vartype instance_type: str - :ivar properties: Additional properties bag. - :vartype properties: dict[str, JSON] + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Custom Keys credential object. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + _attribute_map = { - "instance_count": {"key": "instanceCount", "type": "int"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "properties": {"key": "properties", "type": "{object}"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "CustomKeys"}, } def __init__( self, *, - instance_count: int = 1, - instance_type: Optional[str] = None, - properties: Optional[Dict[str, JSON]] = None, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.CustomKeys"] = None, **kwargs: Any ) -> None: """ - :keyword instance_count: Optional number of instances or nodes used by the compute target. - :paramtype instance_count: int - :keyword instance_type: Optional type of VM used as supported by the compute target. - :paramtype instance_type: str - :keyword properties: Additional properties bag. - :paramtype properties: dict[str, JSON] + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Custom Keys credential object. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.CustomKeys """ - super().__init__(**kwargs) - self.instance_count = instance_count - self.instance_type = instance_type - self.properties = properties + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "CustomKeys" + self.credentials = credentials -class DeploymentResourceConfiguration(ResourceConfiguration): - """DeploymentResourceConfiguration. +class CustomMetricThreshold(_serialization.Model): + """CustomMetricThreshold. - :ivar instance_count: Optional number of instances or nodes used by the compute target. - :vartype instance_count: int - :ivar instance_type: Optional type of VM used as supported by the compute target. - :vartype instance_type: str - :ivar properties: Additional properties bag. - :vartype properties: dict[str, JSON] + All required parameters must be populated in order to send to server. + + :ivar metric: [Required] The user-defined metric to calculate. Required. + :vartype metric: str + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ + _validation = { + "metric": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _attribute_map = { - "instance_count": {"key": "instanceCount", "type": "int"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "properties": {"key": "properties", "type": "{object}"}, + "metric": {"key": "metric", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, } def __init__( - self, - *, - instance_count: int = 1, - instance_type: Optional[str] = None, - properties: Optional[Dict[str, JSON]] = None, - **kwargs: Any + self, *, metric: str, threshold: Optional["_models.MonitoringThreshold"] = None, **kwargs: Any ) -> None: """ - :keyword instance_count: Optional number of instances or nodes used by the compute target. - :paramtype instance_count: int - :keyword instance_type: Optional type of VM used as supported by the compute target. - :paramtype instance_type: str - :keyword properties: Additional properties bag. - :paramtype properties: dict[str, JSON] + :keyword metric: [Required] The user-defined metric to calculate. Required. + :paramtype metric: str + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold """ - super().__init__(instance_count=instance_count, instance_type=instance_type, properties=properties, **kwargs) + super().__init__(**kwargs) + self.metric = metric + self.threshold = threshold -class DiagnoseRequestProperties(_serialization.Model): - """DiagnoseRequestProperties. +class CustomModelFineTuning(FineTuningVertical): + """CustomModelFineTuning. - :ivar udr: Setting for diagnosing user defined routing. - :vartype udr: dict[str, JSON] - :ivar nsg: Setting for diagnosing network security group. - :vartype nsg: dict[str, JSON] - :ivar resource_lock: Setting for diagnosing resource lock. - :vartype resource_lock: dict[str, JSON] - :ivar dns_resolution: Setting for diagnosing dns resolution. - :vartype dns_resolution: dict[str, JSON] - :ivar storage_account: Setting for diagnosing dependent storage account. - :vartype storage_account: dict[str, JSON] - :ivar key_vault: Setting for diagnosing dependent key vault. - :vartype key_vault: dict[str, JSON] - :ivar container_registry: Setting for diagnosing dependent container registry. - :vartype container_registry: dict[str, JSON] - :ivar application_insights: Setting for diagnosing dependent application insights. - :vartype application_insights: dict[str, JSON] - :ivar others: Setting for diagnosing unclassified category of problems. - :vartype others: dict[str, JSON] + All required parameters must be populated in order to send to server. + + :ivar model: [Required] Input model for fine tuning. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar model_provider: [Required] Enum to determine the type of fine tuning. Required. Known + values are: "AzureOpenAI" and "Custom". + :vartype model_provider: str or ~azure.mgmt.machinelearningservices.models.ModelProvider + :ivar task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :ivar training_data: [Required] Training data for fine tuning. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar validation_data: Validation data for fine tuning. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + :ivar hyper_parameters: HyperParameters for fine tuning custom model. + :vartype hyper_parameters: dict[str, str] """ + _validation = { + "model": {"required": True}, + "model_provider": {"required": True}, + "task_type": {"required": True}, + "training_data": {"required": True}, + } + _attribute_map = { - "udr": {"key": "udr", "type": "{object}"}, - "nsg": {"key": "nsg", "type": "{object}"}, - "resource_lock": {"key": "resourceLock", "type": "{object}"}, - "dns_resolution": {"key": "dnsResolution", "type": "{object}"}, - "storage_account": {"key": "storageAccount", "type": "{object}"}, - "key_vault": {"key": "keyVault", "type": "{object}"}, - "container_registry": {"key": "containerRegistry", "type": "{object}"}, - "application_insights": {"key": "applicationInsights", "type": "{object}"}, - "others": {"key": "others", "type": "{object}"}, + "model": {"key": "model", "type": "JobInput"}, + "model_provider": {"key": "modelProvider", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "JobInput"}, + "validation_data": {"key": "validationData", "type": "JobInput"}, + "hyper_parameters": {"key": "hyperParameters", "type": "{str}"}, } def __init__( self, *, - udr: Optional[Dict[str, JSON]] = None, - nsg: Optional[Dict[str, JSON]] = None, - resource_lock: Optional[Dict[str, JSON]] = None, - dns_resolution: Optional[Dict[str, JSON]] = None, - storage_account: Optional[Dict[str, JSON]] = None, - key_vault: Optional[Dict[str, JSON]] = None, - container_registry: Optional[Dict[str, JSON]] = None, - application_insights: Optional[Dict[str, JSON]] = None, - others: Optional[Dict[str, JSON]] = None, + model: "_models.JobInput", + task_type: Union[str, "_models.FineTuningTaskType"], + training_data: "_models.JobInput", + validation_data: Optional["_models.JobInput"] = None, + hyper_parameters: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: """ - :keyword udr: Setting for diagnosing user defined routing. - :paramtype udr: dict[str, JSON] - :keyword nsg: Setting for diagnosing network security group. - :paramtype nsg: dict[str, JSON] - :keyword resource_lock: Setting for diagnosing resource lock. - :paramtype resource_lock: dict[str, JSON] - :keyword dns_resolution: Setting for diagnosing dns resolution. - :paramtype dns_resolution: dict[str, JSON] - :keyword storage_account: Setting for diagnosing dependent storage account. - :paramtype storage_account: dict[str, JSON] - :keyword key_vault: Setting for diagnosing dependent key vault. - :paramtype key_vault: dict[str, JSON] - :keyword container_registry: Setting for diagnosing dependent container registry. - :paramtype container_registry: dict[str, JSON] - :keyword application_insights: Setting for diagnosing dependent application insights. - :paramtype application_insights: dict[str, JSON] - :keyword others: Setting for diagnosing unclassified category of problems. - :paramtype others: dict[str, JSON] + :keyword model: [Required] Input model for fine tuning. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword task_type: [Required] Fine tuning task type. Required. Known values are: + "ChatCompletion", "TextCompletion", "TextClassification", "QuestionAnswering", + "TextSummarization", "TokenClassification", "TextTranslation", "ImageClassification", + "ImageInstanceSegmentation", "ImageObjectDetection", and "VideoMultiObjectTracking". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.FineTuningTaskType + :keyword training_data: [Required] Training data for fine tuning. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword validation_data: Validation data for fine tuning. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.JobInput + :keyword hyper_parameters: HyperParameters for fine tuning custom model. + :paramtype hyper_parameters: dict[str, str] """ - super().__init__(**kwargs) - self.udr = udr - self.nsg = nsg - self.resource_lock = resource_lock - self.dns_resolution = dns_resolution - self.storage_account = storage_account - self.key_vault = key_vault - self.container_registry = container_registry - self.application_insights = application_insights - self.others = others + super().__init__( + model=model, task_type=task_type, training_data=training_data, validation_data=validation_data, **kwargs + ) + self.model_provider: str = "Custom" + self.hyper_parameters = hyper_parameters -class DiagnoseResponseResult(_serialization.Model): - """DiagnoseResponseResult. +class JobInput(_serialization.Model): + """Command job definition. - :ivar value: - :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CustomModelJobInput, LiteralJobInput, MLFlowModelJobInput, MLTableJobInput, + TritonModelJobInput, UriFileJobInput, UriFolderJobInput + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType """ + _validation = { + "job_input_type": {"required": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "DiagnoseResponseResultValue"}, + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, } - def __init__(self, *, value: Optional["_models.DiagnoseResponseResultValue"] = None, **kwargs: Any) -> None: + _subtype_map = { + "job_input_type": { + "custom_model": "CustomModelJobInput", + "literal": "LiteralJobInput", + "mlflow_model": "MLFlowModelJobInput", + "mltable": "MLTableJobInput", + "triton_model": "TritonModelJobInput", + "uri_file": "UriFileJobInput", + "uri_folder": "UriFolderJobInput", + } + } + + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: - :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue + :keyword description: Description for the input. + :paramtype description: str """ super().__init__(**kwargs) - self.value = value + self.description = description + self.job_input_type: Optional[str] = None -class DiagnoseResponseResultValue(_serialization.Model): - """DiagnoseResponseResultValue. +class CustomModelJobInput(AssetJobInput, JobInput): + """CustomModelJobInput. - :ivar user_defined_route_results: - :vartype user_defined_route_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar network_security_rule_results: - :vartype network_security_rule_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar resource_lock_results: - :vartype resource_lock_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar dns_resolution_results: - :vartype dns_resolution_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar storage_account_results: - :vartype storage_account_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar key_vault_results: - :vartype key_vault_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar container_registry_results: - :vartype container_registry_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar application_insights_results: - :vartype application_insights_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :ivar other_results: - :vartype other_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + All required parameters must be populated in order to send to server. + + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str """ + _validation = { + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _attribute_map = { - "user_defined_route_results": {"key": "userDefinedRouteResults", "type": "[DiagnoseResult]"}, - "network_security_rule_results": {"key": "networkSecurityRuleResults", "type": "[DiagnoseResult]"}, - "resource_lock_results": {"key": "resourceLockResults", "type": "[DiagnoseResult]"}, - "dns_resolution_results": {"key": "dnsResolutionResults", "type": "[DiagnoseResult]"}, - "storage_account_results": {"key": "storageAccountResults", "type": "[DiagnoseResult]"}, - "key_vault_results": {"key": "keyVaultResults", "type": "[DiagnoseResult]"}, - "container_registry_results": {"key": "containerRegistryResults", "type": "[DiagnoseResult]"}, - "application_insights_results": {"key": "applicationInsightsResults", "type": "[DiagnoseResult]"}, - "other_results": {"key": "otherResults", "type": "[DiagnoseResult]"}, + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, } def __init__( self, *, - user_defined_route_results: Optional[List["_models.DiagnoseResult"]] = None, - network_security_rule_results: Optional[List["_models.DiagnoseResult"]] = None, - resource_lock_results: Optional[List["_models.DiagnoseResult"]] = None, - dns_resolution_results: Optional[List["_models.DiagnoseResult"]] = None, - storage_account_results: Optional[List["_models.DiagnoseResult"]] = None, - key_vault_results: Optional[List["_models.DiagnoseResult"]] = None, - container_registry_results: Optional[List["_models.DiagnoseResult"]] = None, - application_insights_results: Optional[List["_models.DiagnoseResult"]] = None, - other_results: Optional[List["_models.DiagnoseResult"]] = None, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, **kwargs: Any ) -> None: """ - :keyword user_defined_route_results: - :paramtype user_defined_route_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword network_security_rule_results: - :paramtype network_security_rule_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword resource_lock_results: - :paramtype resource_lock_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword dns_resolution_results: - :paramtype dns_resolution_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword storage_account_results: - :paramtype storage_account_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword key_vault_results: - :paramtype key_vault_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword container_registry_results: - :paramtype container_registry_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword application_insights_results: - :paramtype application_insights_results: - list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] - :keyword other_results: - :paramtype other_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword description: Description for the input. + :paramtype description: str + :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str """ - super().__init__(**kwargs) - self.user_defined_route_results = user_defined_route_results - self.network_security_rule_results = network_security_rule_results - self.resource_lock_results = resource_lock_results - self.dns_resolution_results = dns_resolution_results - self.storage_account_results = storage_account_results - self.key_vault_results = key_vault_results - self.container_registry_results = container_registry_results - self.application_insights_results = application_insights_results - self.other_results = other_results + super().__init__(mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "custom_model" + self.mode = mode + self.uri = uri -class DiagnoseResult(_serialization.Model): - """Result of Diagnose. +class JobOutput(_serialization.Model): + """Job output definition container information on where to find job output/logs. - 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: + CustomModelJobOutput, MLFlowModelJobOutput, MLTableJobOutput, TritonModelJobOutput, + UriFileJobOutput, UriFolderJobOutput - :ivar code: Code for workspace setup error. - :vartype code: str - :ivar level: Level of workspace setup error. Known values are: "Warning", "Error", and - "Information". - :vartype level: str or ~azure.mgmt.machinelearningservices.models.DiagnoseResultLevel - :ivar message: Message of workspace setup error. - :vartype message: str + All required parameters must be populated in order to send to server. + + :ivar description: Description for the output. + :vartype description: str + :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 """ _validation = { - "code": {"readonly": True}, - "level": {"readonly": True}, - "message": {"readonly": True}, + "job_output_type": {"required": True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "message": {"key": "message", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.level = None - self.message = None - - -class DiagnoseWorkspaceParameters(_serialization.Model): - """Parameters to diagnose a workspace. - - :ivar value: Value of Parameters. - :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties - """ - - _attribute_map = { - "value": {"key": "value", "type": "DiagnoseRequestProperties"}, + _subtype_map = { + "job_output_type": { + "custom_model": "CustomModelJobOutput", + "mlflow_model": "MLFlowModelJobOutput", + "mltable": "MLTableJobOutput", + "triton_model": "TritonModelJobOutput", + "uri_file": "UriFileJobOutput", + "uri_folder": "UriFolderJobOutput", + } } - def __init__(self, *, value: Optional["_models.DiagnoseRequestProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword value: Value of Parameters. - :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties + :keyword description: Description for the output. + :paramtype description: str """ super().__init__(**kwargs) - self.value = value - + self.description = description + self.job_output_type: Optional[str] = None -class DistributionConfiguration(_serialization.Model): - """Base definition for job distribution configuration. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - Mpi, PyTorch, TensorFlow +class CustomModelJobOutput(AssetJobOutput, JobOutput): + """CustomModelJobOutput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. - Known values are: "PyTorch", "TensorFlow", and "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar description: Description for the output. + :vartype description: str + :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 asset_name: Output Asset Name. + :vartype asset_name: 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 """ _validation = { - "distribution_type": {"required": True}, - } - - _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, + "job_output_type": {"required": True}, } - _subtype_map = {"distribution_type": {"Mpi": "Mpi", "PyTorch": "PyTorch", "TensorFlow": "TensorFlow"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.distribution_type: Optional[str] = None - - -class Docker(_serialization.Model): - """Docker container configuration. - - :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 - """ - _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "privileged": {"key": "privileged", "type": "bool"}, + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, } def __init__( self, *, - additional_properties: Optional[Dict[str, Any]] = None, - privileged: Optional[bool] = None, + description: Optional[str] = None, + asset_name: Optional[str] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + uri: Optional[str] = None, **kwargs: Any ) -> None: """ - :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 + :keyword description: Description for the output. + :paramtype description: str + :keyword asset_name: Output Asset Name. + :paramtype asset_name: 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.additional_properties = additional_properties - self.privileged = privileged + super().__init__(asset_name=asset_name, mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_output_type: str = "custom_model" + self.asset_name = asset_name + self.mode = mode + self.uri = uri -class EncryptionKeyVaultProperties(_serialization.Model): - """EncryptionKeyVaultProperties. +class MonitoringSignalBase(_serialization.Model): + """MonitoringSignalBase. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + CustomMonitoringSignal, DataDriftMonitoringSignal, DataQualityMonitoringSignal, + FeatureAttributionDriftMonitoringSignal, PredictionDriftMonitoringSignal - :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 + All required parameters must be populated in order to send to server. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType """ _validation = { - "key_vault_arm_id": {"required": True}, - "key_identifier": {"required": True}, + "signal_type": {"required": True}, } _attribute_map = { - "key_vault_arm_id": {"key": "keyVaultArmId", "type": "str"}, - "key_identifier": {"key": "keyIdentifier", "type": "str"}, - "identity_client_id": {"key": "identityClientId", "type": "str"}, + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + } + + _subtype_map = { + "signal_type": { + "Custom": "CustomMonitoringSignal", + "DataDrift": "DataDriftMonitoringSignal", + "DataQuality": "DataQualityMonitoringSignal", + "FeatureAttributionDrift": "FeatureAttributionDriftMonitoringSignal", + "PredictionDrift": "PredictionDriftMonitoringSignal", + } } def __init__( - self, *, key_vault_arm_id: str, key_identifier: str, identity_client_id: Optional[str] = None, **kwargs: Any + self, + *, + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs: Any ) -> None: """ - :keyword key_vault_arm_id: The ArmId of the keyVault where the customer owned encryption key is - present. Required. - :paramtype key_vault_arm_id: str - :keyword key_identifier: Key vault uri to access the encryption key. Required. - :paramtype key_identifier: str - :keyword identity_client_id: For future use - The client id of the identity which will be used - to access key vault. - :paramtype identity_client_id: str + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] """ super().__init__(**kwargs) - self.key_vault_arm_id = key_vault_arm_id - self.key_identifier = key_identifier - self.identity_client_id = identity_client_id + self.notification_types = notification_types + self.properties = properties + self.signal_type: Optional[str] = None -class EncryptionProperty(_serialization.Model): - """EncryptionProperty. +class CustomMonitoringSignal(MonitoringSignalBase): + """CustomMonitoringSignal. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar status: Indicates whether or not the encryption is enabled for the workspace. Required. - Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :ivar identity: The identity that will be used to access the key vault for encryption at rest. - :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :ivar key_vault_properties: Customer Key vault properties. Required. - :vartype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar component_id: [Required] Reference to the component asset used to calculate the custom + metrics. Required. + :vartype component_id: str + :ivar input_assets: Monitoring assets to take as input. Key is the component input port name, + value is the data asset. + :vartype input_assets: dict[str, + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar inputs: Extra component parameters to take as input. Key is the component literal input + port name, value is the parameter value. + :vartype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :ivar metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.CustomMetricThreshold] """ _validation = { - "status": {"required": True}, - "key_vault_properties": {"required": True}, + "signal_type": {"required": True}, + "component_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "metric_thresholds": {"required": True}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, - "identity": {"key": "identity", "type": "IdentityForCmk"}, - "key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultProperties"}, + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "component_id": {"key": "componentId", "type": "str"}, + "input_assets": {"key": "inputAssets", "type": "{MonitoringInputDataBase}"}, + "inputs": {"key": "inputs", "type": "{JobInput}"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[CustomMetricThreshold]"}, } def __init__( self, *, - status: Union[str, "_models.EncryptionStatus"], - key_vault_properties: "_models.EncryptionKeyVaultProperties", - identity: Optional["_models.IdentityForCmk"] = None, + component_id: str, + metric_thresholds: List["_models.CustomMetricThreshold"], + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + input_assets: Optional[Dict[str, "_models.MonitoringInputDataBase"]] = None, + inputs: Optional[Dict[str, "_models.JobInput"]] = None, **kwargs: Any ) -> None: """ - :keyword status: Indicates whether or not the encryption is enabled for the workspace. - Required. Known values are: "Enabled" and "Disabled". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus - :keyword identity: The identity that will be used to access the key vault for encryption at - rest. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk - :keyword key_vault_properties: Customer Key vault properties. Required. - :paramtype key_vault_properties: - ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultProperties + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword component_id: [Required] Reference to the component asset used to calculate the custom + metrics. Required. + :paramtype component_id: str + :keyword input_assets: Monitoring assets to take as input. Key is the component input port + name, value is the data asset. + :paramtype input_assets: dict[str, + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword inputs: Extra component parameters to take as input. Key is the component literal + input port name, value is the parameter value. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.CustomMetricThreshold] """ - super().__init__(**kwargs) - self.status = status - self.identity = identity - self.key_vault_properties = key_vault_properties + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "Custom" + self.component_id = component_id + self.input_assets = input_assets + self.inputs = inputs + self.metric_thresholds = metric_thresholds -class Endpoint(_serialization.Model): - """Describes the endpoint configuration for the container. +class CustomNCrossValidations(NCrossValidations): + """N-Cross validations are specified by user. - :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 + All required parameters must be populated in order to send to server. + + :ivar mode: [Required] Mode for determining N-Cross validations. Required. Known values are: + "Auto" and "Custom". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.NCrossValidationsMode + :ivar value: [Required] N-Cross validations value. Required. + :vartype value: int """ + _validation = { + "mode": {"required": True}, + "value": {"required": True}, + } + _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"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - 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: Any - ) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :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 + :keyword value: [Required] N-Cross validations value. Required. + :paramtype value: int """ super().__init__(**kwargs) - self.protocol = protocol - self.name = name - self.target = target - self.published = published - self.host_ip = host_ip + self.mode: str = "Custom" + self.value = value -class EndpointAuthKeys(_serialization.Model): - """Keys for endpoint authentication. +class CustomSeasonality(Seasonality): + """CustomSeasonality. - :ivar primary_key: The primary key. - :vartype primary_key: str - :ivar secondary_key: The secondary key. - :vartype secondary_key: str + All required parameters must be populated in order to send to server. + + :ivar mode: [Required] Seasonality mode. Required. Known values are: "Auto" and "Custom". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.SeasonalityMode + :ivar value: [Required] Seasonality value. Required. + :vartype value: int """ + _validation = { + "mode": {"required": True}, + "value": {"required": True}, + } + _attribute_map = { - "primary_key": {"key": "primaryKey", "type": "str"}, - "secondary_key": {"key": "secondaryKey", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__( - self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = None, **kwargs: Any - ) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :keyword primary_key: The primary key. - :paramtype primary_key: str - :keyword secondary_key: The secondary key. - :paramtype secondary_key: str + :keyword value: [Required] Seasonality value. Required. + :paramtype value: int """ super().__init__(**kwargs) - self.primary_key = primary_key - self.secondary_key = secondary_key + self.mode: str = "Custom" + self.value = value -class EndpointAuthToken(_serialization.Model): - """Service Token. +class CustomService(_serialization.Model): + """Specifies the custom service configuration. - :ivar access_token: Access token for endpoint authentication. - :vartype access_token: str - :ivar expiry_time_utc: Access token expiry time (UTC). - :vartype expiry_time_utc: int - :ivar refresh_after_time_utc: Refresh access token after time (UTC). - :vartype refresh_after_time_utc: int - :ivar token_type: Access token type. - :vartype token_type: str + :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] + :ivar kernel: Describes the jupyter kernel settings for the image if its a custom environment. + :vartype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ _attribute_map = { - "access_token": {"key": "accessToken", "type": "str"}, - "expiry_time_utc": {"key": "expiryTimeUtc", "type": "int"}, - "refresh_after_time_utc": {"key": "refreshAfterTimeUtc", "type": "int"}, - "token_type": {"key": "tokenType", "type": "str"}, + "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]"}, + "kernel": {"key": "kernel", "type": "JupyterKernelConfig"}, } def __init__( self, *, - access_token: Optional[str] = None, - expiry_time_utc: int = 0, - refresh_after_time_utc: int = 0, - token_type: Optional[str] = None, + 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, + kernel: Optional["_models.JupyterKernelConfig"] = None, **kwargs: Any ) -> None: """ - :keyword access_token: Access token for endpoint authentication. - :paramtype access_token: str - :keyword expiry_time_utc: Access token expiry time (UTC). - :paramtype expiry_time_utc: int - :keyword refresh_after_time_utc: Refresh access token after time (UTC). - :paramtype refresh_after_time_utc: int - :keyword token_type: Access token type. - :paramtype token_type: str + :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] + :keyword kernel: Describes the jupyter kernel settings for the image if its a custom + environment. + :paramtype kernel: ~azure.mgmt.machinelearningservices.models.JupyterKernelConfig """ super().__init__(**kwargs) - self.access_token = access_token - self.expiry_time_utc = expiry_time_utc - self.refresh_after_time_utc = refresh_after_time_utc - self.token_type = token_type - + 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 + self.kernel = kernel -class ScheduleActionBase(_serialization.Model): - """ScheduleActionBase. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - JobScheduleAction, EndpointScheduleAction +class CustomTargetLags(TargetLags): + """CustomTargetLags. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values - are: "CreateJob" and "InvokeBatchEndpoint". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar mode: [Required] Set target lags mode - Auto/Custom. Required. Known values are: "Auto" + and "Custom". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.TargetLagsMode + :ivar values: [Required] Set target lags values. Required. + :vartype values: list[int] """ _validation = { - "action_type": {"required": True}, + "mode": {"required": True}, + "values": {"required": True}, } _attribute_map = { - "action_type": {"key": "actionType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "values": {"key": "values", "type": "[int]"}, } - _subtype_map = {"action_type": {"CreateJob": "JobScheduleAction", "InvokeBatchEndpoint": "EndpointScheduleAction"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, values: List[int], **kwargs: Any) -> None: + """ + :keyword values: [Required] Set target lags values. Required. + :paramtype values: list[int] + """ super().__init__(**kwargs) - self.action_type: Optional[str] = None - - -class EndpointScheduleAction(ScheduleActionBase): - """EndpointScheduleAction. - - All required parameters must be populated in order to send to Azure. + self.mode: str = "Custom" + self.values = values - :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values - are: "CreateJob" and "InvokeBatchEndpoint". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar endpoint_invocation_definition: [Required] Defines Schedule action definition details. +class CustomTargetRollingWindowSize(TargetRollingWindowSize): + """CustomTargetRollingWindowSize. - .. raw:: html + All required parameters must be populated in order to send to server. - . Required. - :vartype endpoint_invocation_definition: JSON + :ivar mode: [Required] TargetRollingWindowSiz detection mode. Required. Known values are: + "Auto" and "Custom". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSizeMode + :ivar value: [Required] TargetRollingWindowSize value. Required. + :vartype value: int """ _validation = { - "action_type": {"required": True}, - "endpoint_invocation_definition": {"required": True}, + "mode": {"required": True}, + "value": {"required": True}, } _attribute_map = { - "action_type": {"key": "actionType", "type": "str"}, - "endpoint_invocation_definition": {"key": "endpointInvocationDefinition", "type": "object"}, + "mode": {"key": "mode", "type": "str"}, + "value": {"key": "value", "type": "int"}, } - def __init__(self, *, endpoint_invocation_definition: JSON, **kwargs: Any) -> None: + def __init__(self, *, value: int, **kwargs: Any) -> None: """ - :keyword endpoint_invocation_definition: [Required] Defines Schedule action definition details. - - - .. raw:: html + :keyword value: [Required] TargetRollingWindowSize value. Required. + :paramtype value: int + """ + super().__init__(**kwargs) + self.mode: str = "Custom" + self.value = value - . Required. - :paramtype endpoint_invocation_definition: JSON + +class DatabricksSchema(_serialization.Model): + """DatabricksSchema. + + :ivar properties: Properties of Databricks. + :vartype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "DatabricksProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DatabricksProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Properties of Databricks. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties """ super().__init__(**kwargs) - self.action_type: str = "InvokeBatchEndpoint" - self.endpoint_invocation_definition = endpoint_invocation_definition + self.properties = properties + + +class Databricks(Compute, DatabricksSchema): # pylint: disable=too-many-instance-attributes + """A DataFactory 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 server. + + :ivar properties: Properties of Databricks. + :vartype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties + :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 + :ivar compute_location: Location for the underlying 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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "DatabricksProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + } + + def __init__( + self, + *, + properties: Optional["_models.DatabricksProperties"] = None, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of Databricks. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatabricksProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool + """ + super().__init__( + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, + properties=properties, + **kwargs + ) + self.properties = properties + self.compute_type: str = "Databricks" + self.compute_location = compute_location + self.provisioning_state = None + self.description = description + self.created_on = None + self.modified_on = None + self.resource_id = resource_id + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = disable_local_auth + + +class DatabricksComputeSecretsProperties(_serialization.Model): + """Properties of Databricks Compute Secrets. + + :ivar databricks_access_token: access token for databricks account. + :vartype databricks_access_token: str + """ + + _attribute_map = { + "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, + } + + def __init__(self, *, databricks_access_token: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword databricks_access_token: access token for databricks account. + :paramtype databricks_access_token: str + """ + super().__init__(**kwargs) + self.databricks_access_token = databricks_access_token + + +class DatabricksComputeSecrets(ComputeSecrets, DatabricksComputeSecretsProperties): + """Secrets related to a Machine Learning compute based on Databricks. + + All required parameters must be populated in order to send to server. + + :ivar databricks_access_token: access token for databricks account. + :vartype databricks_access_token: str + :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 + """ + + _validation = { + "compute_type": {"required": True}, + } + + _attribute_map = { + "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, + "compute_type": {"key": "computeType", "type": "str"}, + } + + def __init__(self, *, databricks_access_token: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword databricks_access_token: access token for databricks account. + :paramtype databricks_access_token: str + """ + super().__init__(databricks_access_token=databricks_access_token, **kwargs) + self.databricks_access_token = databricks_access_token + self.compute_type: str = "Databricks" + + +class DatabricksProperties(_serialization.Model): + """Properties of Databricks. + + :ivar databricks_access_token: Databricks access token. + :vartype databricks_access_token: str + :ivar workspace_url: Workspace Url. + :vartype workspace_url: str + """ + _attribute_map = { + "databricks_access_token": {"key": "databricksAccessToken", "type": "str"}, + "workspace_url": {"key": "workspaceUrl", "type": "str"}, + } + + def __init__( + self, *, databricks_access_token: Optional[str] = None, workspace_url: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword databricks_access_token: Databricks access token. + :paramtype databricks_access_token: str + :keyword workspace_url: Workspace Url. + :paramtype workspace_url: str + """ + super().__init__(**kwargs) + self.databricks_access_token = databricks_access_token + self.workspace_url = workspace_url + + +class DataCollector(_serialization.Model): + """DataCollector. + + All required parameters must be populated in order to send to server. + + :ivar collections: [Required] The collection configuration. Each collection has it own + configuration to collect model data and the name of collection can be arbitrary string. + Model data collector can be used for either payload logging or custom logging or both of them. + Collection request and response are reserved for payload logging, others are for custom + logging. Required. + :vartype collections: dict[str, ~azure.mgmt.machinelearningservices.models.Collection] + :ivar request_logging: The request logging configuration for mdc, it includes advanced logging + settings for all collections. It's optional. + :vartype request_logging: ~azure.mgmt.machinelearningservices.models.RequestLogging + :ivar rolling_rate: When model data is collected to blob storage, we need to roll the data to + different path to avoid logging all of them in a single blob file. + If the rolling rate is hour, all data will be collected in the blob path /yyyy/MM/dd/HH/. + If it's day, all data will be collected in blob path /yyyy/MM/dd/. + The other benefit of rolling path is that model monitoring ui is able to select a time range + of data very quickly. Known values are: "Year", "Month", "Day", "Hour", and "Minute". + :vartype rolling_rate: str or ~azure.mgmt.machinelearningservices.models.RollingRateType + """ + + _validation = { + "collections": {"required": True}, + } + + _attribute_map = { + "collections": {"key": "collections", "type": "{Collection}"}, + "request_logging": {"key": "requestLogging", "type": "RequestLogging"}, + "rolling_rate": {"key": "rollingRate", "type": "str"}, + } -class EnvironmentContainer(Resource): + def __init__( + self, + *, + collections: Dict[str, "_models.Collection"], + request_logging: Optional["_models.RequestLogging"] = None, + rolling_rate: Optional[Union[str, "_models.RollingRateType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword collections: [Required] The collection configuration. Each collection has it own + configuration to collect model data and the name of collection can be arbitrary string. + Model data collector can be used for either payload logging or custom logging or both of them. + Collection request and response are reserved for payload logging, others are for custom + logging. Required. + :paramtype collections: dict[str, ~azure.mgmt.machinelearningservices.models.Collection] + :keyword request_logging: The request logging configuration for mdc, it includes advanced + logging settings for all collections. It's optional. + :paramtype request_logging: ~azure.mgmt.machinelearningservices.models.RequestLogging + :keyword rolling_rate: When model data is collected to blob storage, we need to roll the data + to different path to avoid logging all of them in a single blob file. + If the rolling rate is hour, all data will be collected in the blob path /yyyy/MM/dd/HH/. + If it's day, all data will be collected in blob path /yyyy/MM/dd/. + The other benefit of rolling path is that model monitoring ui is able to select a time range + of data very quickly. Known values are: "Year", "Month", "Day", "Hour", and "Minute". + :paramtype rolling_rate: str or ~azure.mgmt.machinelearningservices.models.RollingRateType + """ + super().__init__(**kwargs) + self.collections = collections + self.request_logging = request_logging + self.rolling_rate = rolling_rate + + +class DataContainer(ProxyResource): """Azure Resource Manager resource envelope. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -8709,7 +10534,7 @@ class EnvironmentContainer(Resource): information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData :ivar properties: [Required] Additional attributes of the entity. Required. - :vartype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :vartype properties: ~azure.mgmt.machinelearningservices.models.DataContainerProperties """ _validation = { @@ -8725,24 +10550,25 @@ class EnvironmentContainer(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "EnvironmentContainerProperties"}, + "properties": {"key": "properties", "type": "DataContainerProperties"}, } - def __init__(self, *, properties: "_models.EnvironmentContainerProperties", **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.DataContainerProperties", **kwargs: Any) -> None: """ :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: - ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataContainerProperties """ super().__init__(**kwargs) self.properties = properties -class EnvironmentContainerProperties(AssetContainer): - """Container for environment specification versions. +class DataContainerProperties(AssetContainer): + """Container for data asset versions. 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 server. + :ivar description: The asset description text. :vartype description: str :ivar properties: The asset property dictionary. @@ -8755,16 +10581,15 @@ 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 + :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 """ _validation = { "latest_version": {"readonly": True}, "next_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "data_type": {"required": True}, } _attribute_map = { @@ -8774,12 +10599,13 @@ 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"}, + "data_type": {"key": "dataType", "type": "str"}, } def __init__( self, *, + data_type: Union[str, "_models.DataType"], description: Optional[str] = None, properties: Optional[Dict[str, str]] = None, tags: Optional[Dict[str, str]] = None, @@ -8795,5363 +10621,14491 @@ def __init__( :paramtype tags: dict[str, str] :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword data_type: [Required] Specifies the type of data. Required. Known values are: + "uri_file", "uri_folder", and "mltable". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.DataType """ super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + self.data_type = data_type -class EnvironmentContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of EnvironmentContainer entities. +class DataContainerResourceArmPaginatedResult(_serialization.Model): + """A paginated list of DataContainer entities. - :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are - no additional pages. + :ivar next_link: The link to the next page of DataContainer objects. If null, there are no + additional pages. :vartype next_link: str - :ivar value: An array of objects of type EnvironmentContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :ivar value: An array of objects of type DataContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.DataContainer] """ _attribute_map = { "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EnvironmentContainer]"}, + "value": {"key": "value", "type": "[DataContainer]"}, } def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.EnvironmentContainer"]] = None, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataContainer"]] = None, **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there - are no additional pages. + :keyword next_link: The link to the next page of DataContainer objects. If null, there are no + additional pages. :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + :keyword value: An array of objects of type DataContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.DataContainer] """ super().__init__(**kwargs) self.next_link = next_link self.value = value -class EnvironmentVariable(_serialization.Model): - """Environment Variables for the container. +class DataDriftMonitoringSignal(MonitoringSignalBase): + """DataDriftMonitoringSignal. - :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 + All required parameters must be populated in order to send to server. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar feature_importance_settings: The settings for computing feature importance. + :vartype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :ivar features: The feature filter which identifies which feature to calculate drift over. + :vartype features: ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterBase + :ivar metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.DataDriftMetricThresholdBase] + :ivar production_data: [Required] The data which drift will be calculated for. Required. + :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar reference_data: [Required] The data to calculate drift against. Required. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ + _validation = { + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "production_data": {"required": True}, + "reference_data": {"required": True}, + } + _attribute_map = { - "additional_properties": {"key": "", "type": "{object}"}, - "type": {"key": "type", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "feature_data_type_override": {"key": "featureDataTypeOverride", "type": "{str}"}, + "feature_importance_settings": {"key": "featureImportanceSettings", "type": "FeatureImportanceSettings"}, + "features": {"key": "features", "type": "MonitoringFeatureFilterBase"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[DataDriftMetricThresholdBase]"}, + "production_data": {"key": "productionData", "type": "MonitoringInputDataBase"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, } def __init__( self, *, - additional_properties: Optional[Dict[str, Any]] = None, - type: Union[str, "_models.EnvironmentVariableType"] = "local", - value: Optional[str] = None, + metric_thresholds: List["_models.DataDriftMetricThresholdBase"], + production_data: "_models.MonitoringInputDataBase", + reference_data: "_models.MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "_models.MonitoringFeatureDataType"]]] = None, + feature_importance_settings: Optional["_models.FeatureImportanceSettings"] = None, + features: Optional["_models.MonitoringFeatureFilterBase"] = None, **kwargs: Any ) -> None: """ - :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 + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword feature_importance_settings: The settings for computing feature importance. + :paramtype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :keyword features: The feature filter which identifies which feature to calculate drift over. + :paramtype features: ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterBase + :keyword metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.DataDriftMetricThresholdBase] + :keyword production_data: [Required] The data which drift will be calculated for. Required. + :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword reference_data: [Required] The data to calculate drift against. Required. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "DataDrift" + self.feature_data_type_override = feature_data_type_override + self.feature_importance_settings = feature_importance_settings + self.features = features + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.reference_data = reference_data -class EnvironmentVersion(Resource): - """Azure Resource Manager resource envelope. +class DataFactory(Compute): + """A DataFactory 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. + All required parameters must be populated in order to send to server. - :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.EnvironmentVersionProperties + :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 + :ivar compute_location: Location for the underlying 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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, } _attribute_map = { - "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": "EnvironmentVersionProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, } - def __init__(self, *, properties: "_models.EnvironmentVersionProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool """ - super().__init__(**kwargs) - self.properties = properties - - -class EnvironmentVersionProperties(AssetBase): # pylint: disable=too-many-instance-attributes - """Environment version details. - - Variables are only populated by the server, and will be ignored when sending a request. + super().__init__( + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, + **kwargs + ) + self.compute_type: str = "DataFactory" - :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 is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Known - values are: "Disabled" and "OnBaseImageUpdate". - :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :ivar build: Configuration settings for Docker build context. - :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of - package, including Python, R, and C/C++ packages. +class DataLakeAnalyticsSchema(_serialization.Model): + """DataLakeAnalyticsSchema. - .. raw:: html + :ivar properties: + :vartype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + """ - . - :vartype conda_file: str - :ivar environment_type: Environment type is either user managed or curated by the Azure ML - service + _attribute_map = { + "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, + } + def __init__( + self, *, properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + """ + super().__init__(**kwargs) + self.properties = properties - .. raw:: html - . Known values are: "Curated" and "UserCreated". - :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType - :ivar image: Name of the image that will be used for the environment. +class DataLakeAnalytics(Compute, DataLakeAnalyticsSchema): # pylint: disable=too-many-instance-attributes + """A DataLakeAnalytics compute. + Variables are only populated by the server, and will be ignored when sending a request. - .. raw:: html + All required parameters must be populated in order to send to server. - . - :vartype image: str - :ivar inference_config: Defines configuration specific to inference. - :vartype inference_config: - ~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". + :ivar properties: + :vartype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + :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 + :ivar compute_location: Location for the underlying 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". :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.AssetProvisioningState - :ivar stage: Stage in the environment lifecycle assigned to this environment. - :vartype stage: str - """ - - _validation = { - "environment_type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, + } + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_anonymous": {"key": "isAnonymous", "type": "bool"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "auto_rebuild": {"key": "autoRebuild", "type": "str"}, - "build": {"key": "build", "type": "BuildContext"}, - "conda_file": {"key": "condaFile", "type": "str"}, - "environment_type": {"key": "environmentType", "type": "str"}, - "image": {"key": "image", "type": "str"}, - "inference_config": {"key": "inferenceConfig", "type": "InferenceContainerProperties"}, - "os_type": {"key": "osType", "type": "str"}, + "properties": {"key": "properties", "type": "DataLakeAnalyticsSchemaProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, - "stage": {"key": "stage", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, } def __init__( self, *, + properties: Optional["_models.DataLakeAnalyticsSchemaProperties"] = None, + compute_location: Optional[str] = None, description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: bool = False, - is_archived: bool = False, - auto_rebuild: Optional[Union[str, "_models.AutoRebuildSetting"]] = None, - build: Optional["_models.BuildContext"] = None, - conda_file: Optional[str] = None, - image: Optional[str] = None, - inference_config: Optional["_models.InferenceContainerProperties"] = None, - os_type: Optional[Union[str, "_models.OperatingSystemType"]] = None, - stage: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, **kwargs: Any ) -> None: """ - :keyword description: The asset description text. + :keyword properties: + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.DataLakeAnalyticsSchemaProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. :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 is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Known - values are: "Disabled" and "OnBaseImageUpdate". - :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting - :keyword build: Configuration settings for Docker build context. - :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext - :keyword conda_file: Standard configuration file used by Conda that lets you install any kind - of package, including Python, R, and C/C++ packages. - - - .. raw:: html - - . - :paramtype conda_file: str - :keyword image: Name of the image that will be used for the environment. - - - .. raw:: html - - . - :paramtype image: str - :keyword inference_config: Defines configuration specific to inference. - :paramtype inference_config: - ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties - :keyword os_type: The OS type of the environment. Known values are: "Linux" and "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType - :keyword stage: Stage in the environment lifecycle assigned to this environment. - :paramtype stage: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool """ super().__init__( + compute_location=compute_location, description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, **kwargs ) - self.auto_rebuild = auto_rebuild - self.build = build - self.conda_file = conda_file - self.environment_type = None - self.image = image - self.inference_config = inference_config - self.os_type = os_type + self.properties = properties + self.compute_type: str = "DataLakeAnalytics" + self.compute_location = compute_location self.provisioning_state = None - self.stage = stage + self.description = description + self.created_on = None + self.modified_on = None + self.resource_id = resource_id + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = disable_local_auth -class EnvironmentVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of EnvironmentVersion entities. +class DataLakeAnalyticsSchemaProperties(_serialization.Model): + """DataLakeAnalyticsSchemaProperties. - :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type EnvironmentVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :ivar data_lake_store_account_name: DataLake Store Account Name. + :vartype data_lake_store_account_name: str """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[EnvironmentVersion]"}, + "data_lake_store_account_name": {"key": "dataLakeStoreAccountName", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.EnvironmentVersion"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, data_lake_store_account_name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type EnvironmentVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + :keyword data_lake_store_account_name: DataLake Store Account Name. + :paramtype data_lake_store_account_name: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.data_lake_store_account_name = data_lake_store_account_name -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. +class DataPathAssetReference(AssetReferenceBase): + """Reference to an asset via its path in a datastore. - 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 server. - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON + :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values + are: "Id", "DataPath", and "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar datastore_id: ARM resource ID of the datastore where the asset is located. + :vartype datastore_id: str + :ivar path: The path of the file/directory in the datastore. + :vartype path: str """ _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, + "reference_type": {"required": True}, } _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, + "reference_type": {"key": "referenceType", "type": "str"}, + "datastore_id": {"key": "datastoreId", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, datastore_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword datastore_id: ARM resource ID of the datastore where the asset is located. + :paramtype datastore_id: str + :keyword path: The path of the file/directory in the datastore. + :paramtype path: str + """ super().__init__(**kwargs) - self.type = None - self.info = None + self.reference_type: str = "DataPath" + self.datastore_id = datastore_id + self.path = path -class ErrorDetail(_serialization.Model): - """The error detail. +class DataQualityMonitoringSignal(MonitoringSignalBase): + """DataQualityMonitoringSignal. - 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 server. - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar feature_importance_settings: The settings for computing feature importance. + :vartype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :ivar features: The features to calculate drift over. + :vartype features: ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterBase + :ivar metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.DataQualityMetricThresholdBase] + :ivar production_data: [Required] The data produced by the production service which drift will + be calculated for. Required. + :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar reference_data: [Required] The data to calculate drift against. Required. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase """ _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "production_data": {"required": True}, + "reference_data": {"required": True}, } _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "feature_data_type_override": {"key": "featureDataTypeOverride", "type": "{str}"}, + "feature_importance_settings": {"key": "featureImportanceSettings", "type": "FeatureImportanceSettings"}, + "features": {"key": "features", "type": "MonitoringFeatureFilterBase"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[DataQualityMetricThresholdBase]"}, + "production_data": {"key": "productionData", "type": "MonitoringInputDataBase"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + def __init__( + self, + *, + metric_thresholds: List["_models.DataQualityMetricThresholdBase"], + production_data: "_models.MonitoringInputDataBase", + reference_data: "_models.MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "_models.MonitoringFeatureDataType"]]] = None, + feature_importance_settings: Optional["_models.FeatureImportanceSettings"] = None, + features: Optional["_models.MonitoringFeatureFilterBase"] = None, + **kwargs: Any + ) -> None: + """ + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword feature_importance_settings: The settings for computing feature importance. + :paramtype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :keyword features: The features to calculate drift over. + :paramtype features: ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterBase + :keyword metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.DataQualityMetricThresholdBase] + :keyword production_data: [Required] The data produced by the production service which drift + will be calculated for. Required. + :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword reference_data: [Required] The data to calculate drift against. Required. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "DataQuality" + self.feature_data_type_override = feature_data_type_override + self.feature_importance_settings = feature_importance_settings + self.features = features + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.reference_data = reference_data + + +class Datastore(ProxyResource): + """Azure Resource Manager resource envelope. + Variables are only populated by the server, and will be ignored when sending a request. -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). + All required parameters must be populated in order to send to server. - :ivar error: The error object. - :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.DatastoreProperties """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + } + _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, + "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": "DatastoreProperties"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.DatastoreProperties", **kwargs: Any) -> None: """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DatastoreProperties """ super().__init__(**kwargs) - self.error = error + self.properties = properties -class EstimatedVMPrice(_serialization.Model): - """The estimated price info for using a VM of a particular OS type, tier, etc. +class DatastoreResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Datastore entities. - All required parameters must be populated in order to send to Azure. + :ivar next_link: The link to the next page of Datastore objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type Datastore. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Datastore] + """ - :ivar retail_price: The price charged for using the VM. Required. - :vartype retail_price: float - :ivar os_type: Operating system type used by the VM. Required. Known values are: "Linux" and - "Windows". - :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :ivar vm_tier: The type of the VM. Required. Known values are: "Standard", "LowPriority", and - "Spot". - :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Datastore]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Datastore"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of Datastore objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type Datastore. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Datastore] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class DataVersionBase(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.DataVersionBaseProperties """ _validation = { - "retail_price": {"required": True}, - "os_type": {"required": True}, - "vm_tier": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "retail_price": {"key": "retailPrice", "type": "float"}, - "os_type": {"key": "osType", "type": "str"}, - "vm_tier": {"key": "vmTier", "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": "DataVersionBaseProperties"}, } - def __init__( - self, - *, - retail_price: float, - os_type: Union[str, "_models.VMPriceOSType"], - vm_tier: Union[str, "_models.VMTier"], - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.DataVersionBaseProperties", **kwargs: Any) -> None: """ - :keyword retail_price: The price charged for using the VM. Required. - :paramtype retail_price: float - :keyword os_type: Operating system type used by the VM. Required. Known values are: "Linux" and - "Windows". - :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType - :keyword vm_tier: The type of the VM. Required. Known values are: "Standard", "LowPriority", - and "Spot". - :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.DataVersionBaseProperties """ super().__init__(**kwargs) - self.retail_price = retail_price - self.os_type = os_type - self.vm_tier = vm_tier + self.properties = properties -class EstimatedVMPrices(_serialization.Model): - """The estimated price info for using a VM. +class DataVersionBaseProperties(AssetBase): + """Data version base definition. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + MLTableData, UriFileDataVersion, UriFolderDataVersion - :ivar billing_currency: Three lettered code specifying the currency of the VM price. Example: - USD. Required. "USD" - :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :ivar unit_of_measure: The unit of time measurement for the specified VM price. Example: - OneHour. Required. "OneHour" - :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :ivar values: The list of estimated prices for using a VM of a particular OS type, tier, etc. - Required. - :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + All required parameters must be populated in order to send to server. + + :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 is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :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. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. + :vartype data_uri: str """ _validation = { - "billing_currency": {"required": True}, - "unit_of_measure": {"required": True}, - "values": {"required": True}, + "data_type": {"required": True}, + "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "billing_currency": {"key": "billingCurrency", "type": "str"}, - "unit_of_measure": {"key": "unitOfMeasure", "type": "str"}, - "values": {"key": "values", "type": "[EstimatedVMPrice]"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "data_type": {"key": "dataType", "type": "str"}, + "data_uri": {"key": "dataUri", "type": "str"}, + } + + _subtype_map = { + "data_type": {"mltable": "MLTableData", "uri_file": "UriFileDataVersion", "uri_folder": "UriFolderDataVersion"} } def __init__( self, *, - billing_currency: Union[str, "_models.BillingCurrency"], - unit_of_measure: Union[str, "_models.UnitOfMeasure"], - values: List["_models.EstimatedVMPrice"], + data_uri: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, **kwargs: Any ) -> None: """ - :keyword billing_currency: Three lettered code specifying the currency of the VM price. - Example: USD. Required. "USD" - :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency - :keyword unit_of_measure: The unit of time measurement for the specified VM price. Example: - OneHour. Required. "OneHour" - :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure - :keyword values: The list of estimated prices for using a VM of a particular OS type, tier, - etc. Required. - :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword data_uri: [Required] Uri of the data. Example: + https://go.microsoft.com/fwlink/?linkid=2202330. Required. + :paramtype data_uri: str """ - super().__init__(**kwargs) - self.billing_currency = billing_currency - self.unit_of_measure = unit_of_measure - self.values = values + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.data_type: Optional[str] = None + self.data_uri = data_uri -class ExternalFQDNResponse(_serialization.Model): - """ExternalFQDNResponse. +class DataVersionBaseResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of DataVersionBase entities. - :ivar value: - :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :ivar next_link: The link to the next page of DataVersionBase objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type DataVersionBase. + :vartype value: list[~azure.mgmt.machinelearningservices.models.DataVersionBase] """ _attribute_map = { - "value": {"key": "value", "type": "[FQDNEndpoints]"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[DataVersionBase]"}, } - def __init__(self, *, value: Optional[List["_models.FQDNEndpoints"]] = None, **kwargs: Any) -> None: + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.DataVersionBase"]] = None, **kwargs: Any + ) -> None: """ - :keyword value: - :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoints] + :keyword next_link: The link to the next page of DataVersionBase objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type DataVersionBase. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.DataVersionBase] """ super().__init__(**kwargs) + self.next_link = next_link self.value = value -class FeaturizationSettings(_serialization.Model): - """Featurization Configuration. +class OnlineScaleSettings(_serialization.Model): + """Online deployment scaling configuration. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str - """ + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DefaultScaleSettings, TargetUtilizationScaleSettings + + All required parameters must be populated in order to send to server. + + :ivar scale_type: [Required] Type of deployment scaling algorithm. Required. Known values are: + "Default" and "TargetUtilization". + :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.ScaleType + """ + + _validation = { + "scale_type": {"required": True}, + } _attribute_map = { - "dataset_language": {"key": "datasetLanguage", "type": "str"}, + "scale_type": {"key": "scaleType", "type": "str"}, } - def __init__(self, *, dataset_language: Optional[str] = None, **kwargs: Any) -> None: + _subtype_map = { + "scale_type": {"Default": "DefaultScaleSettings", "TargetUtilization": "TargetUtilizationScaleSettings"} + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.scale_type: Optional[str] = None + + +class DefaultScaleSettings(OnlineScaleSettings): + """DefaultScaleSettings. + + All required parameters must be populated in order to send to server. + + :ivar scale_type: [Required] Type of deployment scaling algorithm. Required. Known values are: + "Default" and "TargetUtilization". + :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.ScaleType + """ + + _validation = { + "scale_type": {"required": True}, + } + + _attribute_map = { + "scale_type": {"key": "scaleType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.scale_type: str = "Default" + + +class DeltaModelCurrentState(_serialization.Model): + """Contract for DeltaModelCurrentState. + + :ivar count: Gets or sets Count of instances with model. + :vartype count: int + :ivar sample_instance_id: Gets or sets sample of instances with model. + :vartype sample_instance_id: str + :ivar status: Gets or sets status. + :vartype status: str + """ + + _attribute_map = { + "count": {"key": "count", "type": "int"}, + "sample_instance_id": {"key": "sampleInstanceID", "type": "str"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, *, count: int = 0, sample_instance_id: Optional[str] = None, status: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :keyword count: Gets or sets Count of instances with model. + :paramtype count: int + :keyword sample_instance_id: Gets or sets sample of instances with model. + :paramtype sample_instance_id: str + :keyword status: Gets or sets status. + :paramtype status: str """ super().__init__(**kwargs) - self.dataset_language = dataset_language + self.count = count + self.sample_instance_id = sample_instance_id + self.status = status -class FlavorData(_serialization.Model): - """FlavorData. +class DeltaModelListRequest(_serialization.Model): + """DeltaModelListRequest. - :ivar data: Model flavor-specific data. - :vartype data: dict[str, str] + :ivar count: Gets or sets number of delta models to return. Default: -1, means that all will be + returned. + :vartype count: int + :ivar skip_token: Gets or sets skip token for paginated response. + :vartype skip_token: str + :ivar target_base_model: Gets or sets target base model. + :vartype target_base_model: str """ _attribute_map = { - "data": {"key": "data", "type": "{str}"}, + "count": {"key": "count", "type": "int"}, + "skip_token": {"key": "skipToken", "type": "str"}, + "target_base_model": {"key": "targetBaseModel", "type": "str"}, } - def __init__(self, *, data: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + count: int = -1, + skip_token: Optional[str] = None, + target_base_model: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword data: Model flavor-specific data. - :paramtype data: dict[str, str] + :keyword count: Gets or sets number of delta models to return. Default: -1, means that all will + be returned. + :paramtype count: int + :keyword skip_token: Gets or sets skip token for paginated response. + :paramtype skip_token: str + :keyword target_base_model: Gets or sets target base model. + :paramtype target_base_model: str """ super().__init__(**kwargs) - self.data = data + self.count = count + self.skip_token = skip_token + self.target_base_model = target_base_model -class Forecasting(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Forecasting task in AutoML Table vertical. - - All required parameters must be populated in order to send to Azure. +class DeltaModelModifyRequest(_serialization.Model): + """Contract base for DeltaModelChangeRequest. Used for adding or removing. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :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 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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype test_data_size: float - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :vartype weight_column_name: str - :ivar forecasting_settings: Forecasting task specific inputs. - :vartype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings - :ivar primary_metric: Primary metric for forecasting task. Known values are: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and - "NormalizedMeanAbsoluteError". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics - :ivar training_settings: Inputs for training phase for an AutoML Job. - :vartype training_settings: - ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + :ivar add_delta_models: Gets or sets delta models to remove. + :vartype add_delta_models: list[str] + :ivar remove_delta_models: Gets or sets delta models to remove. + :vartype remove_delta_models: list[str] + :ivar target_base_model: Gets or sets target base model. + :vartype target_base_model: str """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, + "add_delta_models": {"unique": True}, + "remove_delta_models": {"unique": True}, } _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, - "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, - "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, - "test_data": {"key": "testData", "type": "MLTableJobInput"}, - "test_data_size": {"key": "testDataSize", "type": "float"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "weight_column_name": {"key": "weightColumnName", "type": "str"}, - "forecasting_settings": {"key": "forecastingSettings", "type": "ForecastingSettings"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, - "training_settings": {"key": "trainingSettings", "type": "ForecastingTrainingSettings"}, + "add_delta_models": {"key": "addDeltaModels", "type": "[str]"}, + "remove_delta_models": {"key": "removeDeltaModels", "type": "[str]"}, + "target_base_model": {"key": "targetBaseModel", "type": "str"}, } def __init__( self, *, - training_data: "_models.MLTableJobInput", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - cv_split_column_names: Optional[List[str]] = None, - featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, - n_cross_validations: Optional["_models.NCrossValidations"] = None, - test_data: Optional["_models.MLTableJobInput"] = None, - test_data_size: Optional[float] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - weight_column_name: Optional[str] = None, - forecasting_settings: Optional["_models.ForecastingSettings"] = None, - primary_metric: Optional[Union[str, "_models.ForecastingPrimaryMetrics"]] = None, - training_settings: Optional["_models.ForecastingTrainingSettings"] = None, + add_delta_models: Optional[List[str]] = None, + remove_delta_models: Optional[List[str]] = None, + target_base_model: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword cv_split_column_names: Columns to use for CVSplit data. - :paramtype cv_split_column_names: list[str] - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :keyword n_cross_validations: Number of cross validation folds to be applied on training - dataset - when validation dataset is not provided. - :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype test_data_size: float - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :paramtype weight_column_name: str - :keyword forecasting_settings: Forecasting task specific inputs. - :paramtype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings - :keyword primary_metric: Primary metric for forecasting task. Known values are: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and - "NormalizedMeanAbsoluteError". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics - :keyword training_settings: Inputs for training phase for an AutoML Job. - :paramtype training_settings: - ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + :keyword add_delta_models: Gets or sets delta models to remove. + :paramtype add_delta_models: list[str] + :keyword remove_delta_models: Gets or sets delta models to remove. + :paramtype remove_delta_models: list[str] + :keyword target_base_model: Gets or sets target base model. + :paramtype target_base_model: str """ - super().__init__( - cv_split_column_names=cv_split_column_names, - featurization_settings=featurization_settings, - limit_settings=limit_settings, - n_cross_validations=n_cross_validations, - test_data=test_data, - test_data_size=test_data_size, - validation_data=validation_data, - validation_data_size=validation_data_size, - weight_column_name=weight_column_name, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "Forecasting" - self.training_data = training_data - self.forecasting_settings = forecasting_settings - self.primary_metric = primary_metric - self.training_settings = training_settings - self.cv_split_column_names = cv_split_column_names - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.n_cross_validations = n_cross_validations - self.test_data = test_data - self.test_data_size = test_data_size - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.weight_column_name = weight_column_name + super().__init__(**kwargs) + self.add_delta_models = add_delta_models + self.remove_delta_models = remove_delta_models + self.target_base_model = target_base_model -class ForecastingSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Forecasting specific parameters. +class DeltaModelStatusRequest(_serialization.Model): + """DeltaModelStatusRequest. - :ivar country_or_region_for_holidays: Country or region for holidays for forecasting tasks. - These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. - :vartype country_or_region_for_holidays: str - :ivar cv_step_size: Number of periods between the origin time of one CV fold and the next fold. - For - example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be - three days apart. - :vartype cv_step_size: int - :ivar feature_lags: Flag for generating lags for the numeric features with 'auto' or null. - Known values are: "None" and "Auto". - :vartype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags - :ivar forecast_horizon: The desired maximum forecast horizon in units of time-series frequency. - :vartype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon - :ivar frequency: When forecasting, this parameter represents the period with which the forecast - is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset frequency - by default. - :vartype frequency: str - :ivar seasonality: Set time series seasonality as an integer multiple of the series frequency. - If seasonality is set to 'auto', it will be inferred. - :vartype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality - :ivar short_series_handling_config: The parameter defining how if AutoML should handle short - time series. Known values are: "None", "Auto", "Pad", and "Drop". - :vartype short_series_handling_config: str or - ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration - :ivar target_aggregate_function: The function to be used to aggregate the time series target - column to conform to a user specified frequency. - If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the - error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". - Known values are: "None", "Sum", "Max", "Min", and "Mean". - :vartype target_aggregate_function: str or - ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction - :ivar target_lags: The number of past periods to lag from the target column. - :vartype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags - :ivar target_rolling_window_size: The number of past periods used to create a rolling window - average of the target column. - :vartype target_rolling_window_size: - ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize - :ivar time_column_name: The name of the time column. This parameter is required when - forecasting to specify the datetime column in the input data used for building the time series - and inferring its frequency. - :vartype time_column_name: str - :ivar time_series_id_column_names: The names of columns used to group a timeseries. It can be - used to create multiple series. - If grain is not defined, the data set is assumed to be one time-series. This parameter is used - with task type forecasting. - :vartype time_series_id_column_names: list[str] - :ivar use_stl: Configure STL Decomposition of the time-series target column. Known values are: - "None", "Season", and "SeasonTrend". - :vartype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + :ivar delta_models: Gets or sets collection of delta models to retrieve status for. + :vartype delta_models: list[str] + :ivar target_base_model: Gets or sets target base model. + :vartype target_base_model: str """ _attribute_map = { - "country_or_region_for_holidays": {"key": "countryOrRegionForHolidays", "type": "str"}, - "cv_step_size": {"key": "cvStepSize", "type": "int"}, - "feature_lags": {"key": "featureLags", "type": "str"}, - "forecast_horizon": {"key": "forecastHorizon", "type": "ForecastHorizon"}, - "frequency": {"key": "frequency", "type": "str"}, - "seasonality": {"key": "seasonality", "type": "Seasonality"}, - "short_series_handling_config": {"key": "shortSeriesHandlingConfig", "type": "str"}, - "target_aggregate_function": {"key": "targetAggregateFunction", "type": "str"}, - "target_lags": {"key": "targetLags", "type": "TargetLags"}, - "target_rolling_window_size": {"key": "targetRollingWindowSize", "type": "TargetRollingWindowSize"}, - "time_column_name": {"key": "timeColumnName", "type": "str"}, - "time_series_id_column_names": {"key": "timeSeriesIdColumnNames", "type": "[str]"}, - "use_stl": {"key": "useStl", "type": "str"}, + "delta_models": {"key": "deltaModels", "type": "[str]"}, + "target_base_model": {"key": "targetBaseModel", "type": "str"}, } def __init__( - self, - *, - country_or_region_for_holidays: Optional[str] = None, - cv_step_size: Optional[int] = None, - feature_lags: Optional[Union[str, "_models.FeatureLags"]] = None, - forecast_horizon: Optional["_models.ForecastHorizon"] = None, - frequency: Optional[str] = None, - seasonality: Optional["_models.Seasonality"] = None, - short_series_handling_config: Optional[Union[str, "_models.ShortSeriesHandlingConfiguration"]] = None, - target_aggregate_function: Optional[Union[str, "_models.TargetAggregationFunction"]] = None, - target_lags: Optional["_models.TargetLags"] = None, - target_rolling_window_size: Optional["_models.TargetRollingWindowSize"] = None, - time_column_name: Optional[str] = None, - time_series_id_column_names: Optional[List[str]] = None, - use_stl: Optional[Union[str, "_models.UseStl"]] = None, - **kwargs: Any + self, *, delta_models: Optional[List[str]] = None, target_base_model: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword country_or_region_for_holidays: Country or region for holidays for forecasting tasks. - These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. - :paramtype country_or_region_for_holidays: str - :keyword cv_step_size: Number of periods between the origin time of one CV fold and the next - fold. For - example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be - three days apart. - :paramtype cv_step_size: int - :keyword feature_lags: Flag for generating lags for the numeric features with 'auto' or null. - Known values are: "None" and "Auto". - :paramtype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags - :keyword forecast_horizon: The desired maximum forecast horizon in units of time-series - frequency. - :paramtype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon - :keyword frequency: When forecasting, this parameter represents the period with which the - forecast is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset - frequency by default. - :paramtype frequency: str - :keyword seasonality: Set time series seasonality as an integer multiple of the series - frequency. - If seasonality is set to 'auto', it will be inferred. - :paramtype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality - :keyword short_series_handling_config: The parameter defining how if AutoML should handle short - time series. Known values are: "None", "Auto", "Pad", and "Drop". - :paramtype short_series_handling_config: str or - ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration - :keyword target_aggregate_function: The function to be used to aggregate the time series target - column to conform to a user specified frequency. - If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the - error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". - Known values are: "None", "Sum", "Max", "Min", and "Mean". - :paramtype target_aggregate_function: str or - ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction - :keyword target_lags: The number of past periods to lag from the target column. - :paramtype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags - :keyword target_rolling_window_size: The number of past periods used to create a rolling window - average of the target column. - :paramtype target_rolling_window_size: - ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize - :keyword time_column_name: The name of the time column. This parameter is required when - forecasting to specify the datetime column in the input data used for building the time series - and inferring its frequency. - :paramtype time_column_name: str - :keyword time_series_id_column_names: The names of columns used to group a timeseries. It can - be used to create multiple series. - If grain is not defined, the data set is assumed to be one time-series. This parameter is used - with task type forecasting. - :paramtype time_series_id_column_names: list[str] - :keyword use_stl: Configure STL Decomposition of the time-series target column. Known values - are: "None", "Season", and "SeasonTrend". - :paramtype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + :keyword delta_models: Gets or sets collection of delta models to retrieve status for. + :paramtype delta_models: list[str] + :keyword target_base_model: Gets or sets target base model. + :paramtype target_base_model: str """ super().__init__(**kwargs) - self.country_or_region_for_holidays = country_or_region_for_holidays - self.cv_step_size = cv_step_size - self.feature_lags = feature_lags - self.forecast_horizon = forecast_horizon - self.frequency = frequency - self.seasonality = seasonality - self.short_series_handling_config = short_series_handling_config - self.target_aggregate_function = target_aggregate_function - self.target_lags = target_lags - self.target_rolling_window_size = target_rolling_window_size - self.time_column_name = time_column_name - self.time_series_id_column_names = time_series_id_column_names - self.use_stl = use_stl + self.delta_models = delta_models + self.target_base_model = target_base_model -class ForecastingTrainingSettings(TrainingSettings): - """Forecasting Training related configuration. +class DeltaModelStatusResponse(_serialization.Model): + """Contract returning to user the delta models. - :ivar enable_dnn_training: Enable recommendation of DNN models. - :vartype enable_dnn_training: bool - :ivar enable_model_explainability: Flag to turn on explainability on best model. - :vartype enable_model_explainability: bool - :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :vartype enable_onnx_compatible_models: bool - :ivar enable_stack_ensemble: Enable stack ensemble run. - :vartype enable_stack_ensemble: bool - :ivar enable_vote_ensemble: Enable voting ensemble run. - :vartype enable_vote_ensemble: bool - :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :vartype ensemble_model_download_timeout: ~datetime.timedelta - :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :vartype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :ivar allowed_training_algorithms: Allowed models for forecasting task. - :vartype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] - :ivar blocked_training_algorithms: Blocked models for forecasting task. - :vartype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :ivar actual_instance_count: Gets or sets actual instance count. + :vartype actual_instance_count: int + :ivar delta_models: Gets or sets dictionary representing modelID and its current state. + :vartype delta_models: dict[str, + list[~azure.mgmt.machinelearningservices.models.DeltaModelCurrentState]] + :ivar expected_instance_count: Gets or sets expected instance count. + :vartype expected_instance_count: int + :ivar revision_id: Gets or sets revision ID. + :vartype revision_id: str + :ivar target_base_model: Gets or sets target base model. + :vartype target_base_model: str """ _attribute_map = { - "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, - "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, - "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, - "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, - "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, - "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, - "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, - "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, - "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, + "actual_instance_count": {"key": "actualInstanceCount", "type": "int"}, + "delta_models": {"key": "deltaModels", "type": "{[DeltaModelCurrentState]}"}, + "expected_instance_count": {"key": "expectedInstanceCount", "type": "int"}, + "revision_id": {"key": "revisionId", "type": "str"}, + "target_base_model": {"key": "targetBaseModel", "type": "str"}, } def __init__( self, *, - enable_dnn_training: bool = False, - enable_model_explainability: bool = True, - enable_onnx_compatible_models: bool = False, - enable_stack_ensemble: bool = True, - enable_vote_ensemble: bool = True, - ensemble_model_download_timeout: datetime.timedelta = "PT5M", - stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, - allowed_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, - blocked_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, + actual_instance_count: int = 0, + delta_models: Optional[Dict[str, List["_models.DeltaModelCurrentState"]]] = None, + expected_instance_count: int = 0, + revision_id: Optional[str] = None, + target_base_model: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword enable_dnn_training: Enable recommendation of DNN models. - :paramtype enable_dnn_training: bool - :keyword enable_model_explainability: Flag to turn on explainability on best model. - :paramtype enable_model_explainability: bool - :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :paramtype enable_onnx_compatible_models: bool - :keyword enable_stack_ensemble: Enable stack ensemble run. - :paramtype enable_stack_ensemble: bool - :keyword enable_vote_ensemble: Enable voting ensemble run. - :paramtype enable_vote_ensemble: bool - :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :paramtype ensemble_model_download_timeout: ~datetime.timedelta - :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :paramtype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :keyword allowed_training_algorithms: Allowed models for forecasting task. - :paramtype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] - :keyword blocked_training_algorithms: Blocked models for forecasting task. - :paramtype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :keyword actual_instance_count: Gets or sets actual instance count. + :paramtype actual_instance_count: int + :keyword delta_models: Gets or sets dictionary representing modelID and its current state. + :paramtype delta_models: dict[str, + list[~azure.mgmt.machinelearningservices.models.DeltaModelCurrentState]] + :keyword expected_instance_count: Gets or sets expected instance count. + :paramtype expected_instance_count: int + :keyword revision_id: Gets or sets revision ID. + :paramtype revision_id: str + :keyword target_base_model: Gets or sets target base model. + :paramtype target_base_model: str """ - super().__init__( - enable_dnn_training=enable_dnn_training, - enable_model_explainability=enable_model_explainability, - enable_onnx_compatible_models=enable_onnx_compatible_models, - enable_stack_ensemble=enable_stack_ensemble, - enable_vote_ensemble=enable_vote_ensemble, - ensemble_model_download_timeout=ensemble_model_download_timeout, - stack_ensemble_settings=stack_ensemble_settings, - **kwargs - ) - self.allowed_training_algorithms = allowed_training_algorithms - self.blocked_training_algorithms = blocked_training_algorithms + super().__init__(**kwargs) + self.actual_instance_count = actual_instance_count + self.delta_models = delta_models + self.expected_instance_count = expected_instance_count + self.revision_id = revision_id + self.target_base_model = target_base_model -class FQDNEndpoint(_serialization.Model): - """FQDNEndpoint. +class DeploymentLogs(_serialization.Model): + """DeploymentLogs. - :ivar domain_name: - :vartype domain_name: str - :ivar endpoint_details: - :vartype endpoint_details: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + :ivar content: The retrieved online deployment logs. + :vartype content: str """ _attribute_map = { - "domain_name": {"key": "domainName", "type": "str"}, - "endpoint_details": {"key": "endpointDetails", "type": "[FQDNEndpointDetail]"}, + "content": {"key": "content", "type": "str"}, } - def __init__( - self, - *, - domain_name: Optional[str] = None, - endpoint_details: Optional[List["_models.FQDNEndpointDetail"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, content: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword domain_name: - :paramtype domain_name: str - :keyword endpoint_details: - :paramtype endpoint_details: - list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + :keyword content: The retrieved online deployment logs. + :paramtype content: str """ super().__init__(**kwargs) - self.domain_name = domain_name - self.endpoint_details = endpoint_details + self.content = content -class FQDNEndpointDetail(_serialization.Model): - """FQDNEndpointDetail. +class DeploymentLogsRequest(_serialization.Model): + """DeploymentLogsRequest. - :ivar port: - :vartype port: int + :ivar container_type: The type of container to retrieve logs from. Known values are: + "StorageInitializer" and "InferenceServer". + :vartype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType + :ivar tail: The maximum number of lines to tail. + :vartype tail: int """ _attribute_map = { - "port": {"key": "port", "type": "int"}, + "container_type": {"key": "containerType", "type": "str"}, + "tail": {"key": "tail", "type": "int"}, } - def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword port: - :paramtype port: int - """ + def __init__( + self, + *, + container_type: Optional[Union[str, "_models.ContainerType"]] = None, + tail: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_type: The type of container to retrieve logs from. Known values are: + "StorageInitializer" and "InferenceServer". + :paramtype container_type: str or ~azure.mgmt.machinelearningservices.models.ContainerType + :keyword tail: The maximum number of lines to tail. + :paramtype tail: int + """ super().__init__(**kwargs) - self.port = port + self.container_type = container_type + self.tail = tail -class FQDNEndpoints(_serialization.Model): - """FQDNEndpoints. +class ResourceConfiguration(_serialization.Model): + """ResourceConfiguration. - :ivar properties: - :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + :ivar instance_count: Optional number of instances or nodes used by the compute target. + :vartype instance_count: int + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar properties: Additional properties bag. + :vartype properties: dict[str, JSON] """ _attribute_map = { - "properties": {"key": "properties", "type": "FQDNEndpointsProperties"}, + "instance_count": {"key": "instanceCount", "type": "int"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "properties": {"key": "properties", "type": "{object}"}, } - def __init__(self, *, properties: Optional["_models.FQDNEndpointsProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + instance_count: int = 1, + instance_type: Optional[str] = None, + properties: Optional[Dict[str, JSON]] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: - :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpointsProperties + :keyword instance_count: Optional number of instances or nodes used by the compute target. + :paramtype instance_count: int + :keyword instance_type: Optional type of VM used as supported by the compute target. + :paramtype instance_type: str + :keyword properties: Additional properties bag. + :paramtype properties: dict[str, JSON] """ super().__init__(**kwargs) + self.instance_count = instance_count + self.instance_type = instance_type self.properties = properties -class FQDNEndpointsProperties(_serialization.Model): - """FQDNEndpointsProperties. +class DeploymentResourceConfiguration(ResourceConfiguration): + """DeploymentResourceConfiguration. - :ivar category: - :vartype category: str - :ivar endpoints: - :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + :ivar instance_count: Optional number of instances or nodes used by the compute target. + :vartype instance_count: int + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar properties: Additional properties bag. + :vartype properties: dict[str, JSON] + """ + + +class DestinationAsset(_serialization.Model): + """Publishing destination registry asset information. + + :ivar destination_name: Destination asset name. + :vartype destination_name: str + :ivar destination_version: Destination asset version. + :vartype destination_version: str + :ivar registry_name: Destination registry name. + :vartype registry_name: str """ _attribute_map = { - "category": {"key": "category", "type": "str"}, - "endpoints": {"key": "endpoints", "type": "[FQDNEndpoint]"}, + "destination_name": {"key": "destinationName", "type": "str"}, + "destination_version": {"key": "destinationVersion", "type": "str"}, + "registry_name": {"key": "registryName", "type": "str"}, } def __init__( - self, *, category: Optional[str] = None, endpoints: Optional[List["_models.FQDNEndpoint"]] = None, **kwargs: Any + self, + *, + destination_name: Optional[str] = None, + destination_version: Optional[str] = None, + registry_name: Optional[str] = None, + **kwargs: Any ) -> None: """ - :keyword category: - :paramtype category: str - :keyword endpoints: - :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + :keyword destination_name: Destination asset name. + :paramtype destination_name: str + :keyword destination_version: Destination asset version. + :paramtype destination_version: str + :keyword registry_name: Destination registry name. + :paramtype registry_name: str """ super().__init__(**kwargs) - self.category = category - self.endpoints = endpoints + self.destination_name = destination_name + self.destination_version = destination_version + self.registry_name = registry_name -class GridSamplingAlgorithm(SamplingAlgorithm): - """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. - - All required parameters must be populated in order to send to Azure. +class DiagnoseRequestProperties(_serialization.Model): + """DiagnoseRequestProperties. - :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter - values, along with configuration properties. Required. Known values are: "Grid", "Random", and - "Bayesian". - :vartype sampling_algorithm_type: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :ivar application_insights: Setting for diagnosing dependent application insights. + :vartype application_insights: dict[str, any] + :ivar container_registry: Setting for diagnosing dependent container registry. + :vartype container_registry: dict[str, any] + :ivar dns_resolution: Setting for diagnosing dns resolution. + :vartype dns_resolution: dict[str, any] + :ivar key_vault: Setting for diagnosing dependent key vault. + :vartype key_vault: dict[str, any] + :ivar nsg: Setting for diagnosing network security group. + :vartype nsg: dict[str, any] + :ivar others: Setting for diagnosing unclassified category of problems. + :vartype others: dict[str, any] + :ivar required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :vartype required_resource_providers: dict[str, any] + :ivar resource_lock: Setting for diagnosing resource lock. + :vartype resource_lock: dict[str, any] + :ivar storage_account: Setting for diagnosing dependent storage account. + :vartype storage_account: dict[str, any] + :ivar udr: Setting for diagnosing user defined routing. + :vartype udr: dict[str, any] """ - _validation = { - "sampling_algorithm_type": {"required": True}, - } - _attribute_map = { - "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, + "application_insights": {"key": "applicationInsights", "type": "{object}"}, + "container_registry": {"key": "containerRegistry", "type": "{object}"}, + "dns_resolution": {"key": "dnsResolution", "type": "{object}"}, + "key_vault": {"key": "keyVault", "type": "{object}"}, + "nsg": {"key": "nsg", "type": "{object}"}, + "others": {"key": "others", "type": "{object}"}, + "required_resource_providers": {"key": "requiredResourceProviders", "type": "{object}"}, + "resource_lock": {"key": "resourceLock", "type": "{object}"}, + "storage_account": {"key": "storageAccount", "type": "{object}"}, + "udr": {"key": "udr", "type": "{object}"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + application_insights: Optional[Dict[str, Any]] = None, + container_registry: Optional[Dict[str, Any]] = None, + dns_resolution: Optional[Dict[str, Any]] = None, + key_vault: Optional[Dict[str, Any]] = None, + nsg: Optional[Dict[str, Any]] = None, + others: Optional[Dict[str, Any]] = None, + required_resource_providers: Optional[Dict[str, Any]] = None, + resource_lock: Optional[Dict[str, Any]] = None, + storage_account: Optional[Dict[str, Any]] = None, + udr: Optional[Dict[str, Any]] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_insights: Setting for diagnosing dependent application insights. + :paramtype application_insights: dict[str, any] + :keyword container_registry: Setting for diagnosing dependent container registry. + :paramtype container_registry: dict[str, any] + :keyword dns_resolution: Setting for diagnosing dns resolution. + :paramtype dns_resolution: dict[str, any] + :keyword key_vault: Setting for diagnosing dependent key vault. + :paramtype key_vault: dict[str, any] + :keyword nsg: Setting for diagnosing network security group. + :paramtype nsg: dict[str, any] + :keyword others: Setting for diagnosing unclassified category of problems. + :paramtype others: dict[str, any] + :keyword required_resource_providers: Setting for diagnosing the presence of required resource + providers in the workspace. + :paramtype required_resource_providers: dict[str, any] + :keyword resource_lock: Setting for diagnosing resource lock. + :paramtype resource_lock: dict[str, any] + :keyword storage_account: Setting for diagnosing dependent storage account. + :paramtype storage_account: dict[str, any] + :keyword udr: Setting for diagnosing user defined routing. + :paramtype udr: dict[str, any] + """ super().__init__(**kwargs) - self.sampling_algorithm_type: str = "Grid" + self.application_insights = application_insights + self.container_registry = container_registry + self.dns_resolution = dns_resolution + self.key_vault = key_vault + self.nsg = nsg + self.others = others + self.required_resource_providers = required_resource_providers + self.resource_lock = resource_lock + self.storage_account = storage_account + self.udr = udr -class HDInsightSchema(_serialization.Model): - """HDInsightSchema. +class DiagnoseResponseResult(_serialization.Model): + """DiagnoseResponseResult. - :ivar properties: HDInsight compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :ivar value: + :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue """ _attribute_map = { - "properties": {"key": "properties", "type": "HDInsightProperties"}, + "value": {"key": "value", "type": "DiagnoseResponseResultValue"}, } - def __init__(self, *, properties: Optional["_models.HDInsightProperties"] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional["_models.DiagnoseResponseResultValue"] = None, **kwargs: Any) -> None: """ - :keyword properties: HDInsight compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :keyword value: + :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseResponseResultValue """ super().__init__(**kwargs) - self.properties = properties - - -class HDInsight(Compute, HDInsightSchema): # pylint: disable=too-many-instance-attributes - """A HDInsight compute. + self.value = value - 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. +class DiagnoseResponseResultValue(_serialization.Model): + """DiagnoseResponseResultValue. - :ivar properties: HDInsight compute properties. - :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties - :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 - :ivar compute_location: Location for the underlying 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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar user_defined_route_results: + :vartype user_defined_route_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar network_security_rule_results: + :vartype network_security_rule_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar resource_lock_results: + :vartype resource_lock_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar dns_resolution_results: + :vartype dns_resolution_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar storage_account_results: + :vartype storage_account_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar key_vault_results: + :vartype key_vault_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar container_registry_results: + :vartype container_registry_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar application_insights_results: + :vartype application_insights_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :ivar other_results: + :vartype other_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] """ - _validation = { - "compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, - } - _attribute_map = { - "properties": {"key": "properties", "type": "HDInsightProperties"}, - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "user_defined_route_results": {"key": "userDefinedRouteResults", "type": "[DiagnoseResult]"}, + "network_security_rule_results": {"key": "networkSecurityRuleResults", "type": "[DiagnoseResult]"}, + "resource_lock_results": {"key": "resourceLockResults", "type": "[DiagnoseResult]"}, + "dns_resolution_results": {"key": "dnsResolutionResults", "type": "[DiagnoseResult]"}, + "storage_account_results": {"key": "storageAccountResults", "type": "[DiagnoseResult]"}, + "key_vault_results": {"key": "keyVaultResults", "type": "[DiagnoseResult]"}, + "container_registry_results": {"key": "containerRegistryResults", "type": "[DiagnoseResult]"}, + "application_insights_results": {"key": "applicationInsightsResults", "type": "[DiagnoseResult]"}, + "other_results": {"key": "otherResults", "type": "[DiagnoseResult]"}, } def __init__( self, *, - properties: Optional["_models.HDInsightProperties"] = None, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword properties: HDInsight compute properties. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool - """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - properties=properties, - **kwargs - ) - self.properties = properties - self.compute_type: str = "HDInsight" - self.compute_location = compute_location - self.provisioning_state = None - self.description = description - self.created_on = None - self.modified_on = None - self.resource_id = resource_id - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = disable_local_auth - - -class HDInsightProperties(_serialization.Model): - """HDInsight compute properties. - - :ivar ssh_port: Port open for ssh connections on the master node of the cluster. - :vartype ssh_port: int - :ivar address: Public IP address of the master node of the cluster. - :vartype address: str - :ivar administrator_account: Admin credentials for master node of the cluster. - :vartype administrator_account: - ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials - """ - - _attribute_map = { - "ssh_port": {"key": "sshPort", "type": "int"}, - "address": {"key": "address", "type": "str"}, - "administrator_account": {"key": "administratorAccount", "type": "VirtualMachineSshCredentials"}, - } - - def __init__( - self, - *, - ssh_port: Optional[int] = None, - address: Optional[str] = None, - administrator_account: Optional["_models.VirtualMachineSshCredentials"] = None, + user_defined_route_results: Optional[List["_models.DiagnoseResult"]] = None, + network_security_rule_results: Optional[List["_models.DiagnoseResult"]] = None, + resource_lock_results: Optional[List["_models.DiagnoseResult"]] = None, + dns_resolution_results: Optional[List["_models.DiagnoseResult"]] = None, + storage_account_results: Optional[List["_models.DiagnoseResult"]] = None, + key_vault_results: Optional[List["_models.DiagnoseResult"]] = None, + container_registry_results: Optional[List["_models.DiagnoseResult"]] = None, + application_insights_results: Optional[List["_models.DiagnoseResult"]] = None, + other_results: Optional[List["_models.DiagnoseResult"]] = None, **kwargs: Any ) -> None: """ - :keyword ssh_port: Port open for ssh connections on the master node of the cluster. - :paramtype ssh_port: int - :keyword address: Public IP address of the master node of the cluster. - :paramtype address: str - :keyword administrator_account: Admin credentials for master node of the cluster. - :paramtype administrator_account: - ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials + :keyword user_defined_route_results: + :paramtype user_defined_route_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword network_security_rule_results: + :paramtype network_security_rule_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword resource_lock_results: + :paramtype resource_lock_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword dns_resolution_results: + :paramtype dns_resolution_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword storage_account_results: + :paramtype storage_account_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword key_vault_results: + :paramtype key_vault_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword container_registry_results: + :paramtype container_registry_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword application_insights_results: + :paramtype application_insights_results: + list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] + :keyword other_results: + :paramtype other_results: list[~azure.mgmt.machinelearningservices.models.DiagnoseResult] """ super().__init__(**kwargs) - self.ssh_port = ssh_port - self.address = address - self.administrator_account = administrator_account + self.user_defined_route_results = user_defined_route_results + self.network_security_rule_results = network_security_rule_results + self.resource_lock_results = resource_lock_results + self.dns_resolution_results = dns_resolution_results + self.storage_account_results = storage_account_results + self.key_vault_results = key_vault_results + self.container_registry_results = container_registry_results + self.application_insights_results = application_insights_results + self.other_results = other_results -class IdAssetReference(AssetReferenceBase): - """Reference to an asset via its ARM resource ID. +class DiagnoseResult(_serialization.Model): + """Result of Diagnose. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values - are: "Id", "DataPath", and "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar asset_id: [Required] ARM resource ID of the asset. Required. - :vartype asset_id: str + :ivar code: Code for workspace setup error. + :vartype code: str + :ivar level: Level of workspace setup error. Known values are: "Warning", "Error", and + "Information". + :vartype level: str or ~azure.mgmt.machinelearningservices.models.DiagnoseResultLevel + :ivar message: Message of workspace setup error. + :vartype message: str """ _validation = { - "reference_type": {"required": True}, - "asset_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "code": {"readonly": True}, + "level": {"readonly": True}, + "message": {"readonly": True}, } _attribute_map = { - "reference_type": {"key": "referenceType", "type": "str"}, - "asset_id": {"key": "assetId", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "level": {"key": "level", "type": "str"}, + "message": {"key": "message", "type": "str"}, } - def __init__(self, *, asset_id: str, **kwargs: Any) -> None: - """ - :keyword asset_id: [Required] ARM resource ID of the asset. Required. - :paramtype asset_id: str - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.reference_type: str = "Id" - self.asset_id = asset_id + self.code = None + self.level = None + self.message = None -class IdentityForCmk(_serialization.Model): - """Identity that will be used to access key vault for encryption at rest. +class DiagnoseWorkspaceParameters(_serialization.Model): + """Parameters to diagnose a workspace. - :ivar user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. - :vartype user_assigned_identity: str + :ivar value: + :vartype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ _attribute_map = { - "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, + "value": {"key": "value", "type": "DiagnoseRequestProperties"}, } - def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional["_models.DiagnoseRequestProperties"] = None, **kwargs: Any) -> None: """ - :keyword user_assigned_identity: The ArmId of the user assigned identity that will be used to - access the customer managed key vault. - :paramtype user_assigned_identity: str + :keyword value: + :paramtype value: ~azure.mgmt.machinelearningservices.models.DiagnoseRequestProperties """ super().__init__(**kwargs) - self.user_assigned_identity = user_assigned_identity + self.value = value -class IdleShutdownSetting(_serialization.Model): - """Stops compute instance after user defined period of inactivity. +class DistributionConfiguration(_serialization.Model): + """Base definition for job distribution configuration. - :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 + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + Mpi, PyTorch, TensorFlow + + All required parameters must be populated in order to send to server. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", and "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType """ + _validation = { + "distribution_type": {"required": True}, + } + _attribute_map = { - "idle_time_before_shutdown": {"key": "idleTimeBeforeShutdown", "type": "str"}, + "distribution_type": {"key": "distributionType", "type": "str"}, } - def __init__(self, *, idle_time_before_shutdown: Optional[str] = None, **kwargs: Any) -> None: - """ - :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 - """ + _subtype_map = {"distribution_type": {"Mpi": "Mpi", "PyTorch": "PyTorch", "TensorFlow": "TensorFlow"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.idle_time_before_shutdown = idle_time_before_shutdown + self.distribution_type: Optional[str] = None -class Image(_serialization.Model): - """Describes the Image Specifications. +class Docker(_serialization.Model): + """Docker. :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. - :vartype reference: str + :ivar privileged: Indicate whether container shall run in privileged or non-privileged mode. + :vartype privileged: bool """ _attribute_map = { "additional_properties": {"key": "", "type": "{object}"}, - "type": {"key": "type", "type": "str"}, - "reference": {"key": "reference", "type": "str"}, + "privileged": {"key": "privileged", "type": "bool"}, } def __init__( self, *, additional_properties: Optional[Dict[str, Any]] = None, - type: Union[str, "_models.ImageType"] = "docker", - reference: Optional[str] = None, + privileged: Optional[bool] = None, **kwargs: Any ) -> None: """ :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. - :paramtype reference: str + :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.type = type - self.reference = reference + self.privileged = privileged -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. +class DockerCredential(DataReferenceCredential): + """Credential for docker with username and password. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "SAS", "DockerCredentials", "ManagedIdentity", and "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + :ivar password: DockerCredential user password. + :vartype password: str + :ivar user_name: DockerCredential user name. + :vartype user_name: str """ _validation = { - "limit_settings": {"required": True}, + "credential_type": {"required": True}, } _attribute_map = { - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "user_name": {"key": "userName", "type": "str"}, } - def __init__( - self, - *, - limit_settings: "_models.ImageLimitSettings", - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, password: Optional[str] = None, user_name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float + :keyword password: DockerCredential user password. + :paramtype password: str + :keyword user_name: DockerCredential user name. + :paramtype user_name: str """ super().__init__(**kwargs) - self.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size + self.credential_type: str = "DockerCredentials" + self.password = password + self.user_name = user_name -class ImageClassificationBase(ImageVertical): - """ImageClassificationBase. +class EncryptionKeyVaultUpdateProperties(_serialization.Model): + """EncryptionKeyVaultUpdateProperties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :ivar key_identifier: Required. + :vartype key_identifier: str """ _validation = { - "limit_settings": {"required": True}, + "key_identifier": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + } + + def __init__(self, *, key_identifier: str, **kwargs: Any) -> None: + """ + :keyword key_identifier: Required. + :paramtype key_identifier: str + """ + super().__init__(**kwargs) + self.key_identifier = key_identifier + + +class EncryptionProperty(_serialization.Model): + """EncryptionProperty. + + All required parameters must be populated in order to send to server. + + :ivar cosmos_db_resource_id: The byok cosmosdb account that customer brings to store customer's + data + with encryption. + :vartype cosmos_db_resource_id: str + :ivar identity: Identity to be used with the keyVault. + :vartype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :ivar key_vault_properties: KeyVault details to do the encryption. Required. + :vartype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :ivar search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :vartype search_account_resource_id: str + :ivar status: Indicates whether or not the encryption is enabled for the workspace. Required. + Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus + :ivar storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :vartype storage_account_resource_id: str + """ + + _validation = { + "key_vault_properties": {"required": True}, + "status": {"required": True}, + } + + _attribute_map = { + "cosmos_db_resource_id": {"key": "cosmosDbResourceId", "type": "str"}, + "identity": {"key": "identity", "type": "IdentityForCmk"}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, + "search_account_resource_id": {"key": "searchAccountResourceId", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "storage_account_resource_id": {"key": "storageAccountResourceId", "type": "str"}, } def __init__( self, *, - limit_settings: "_models.ImageLimitSettings", - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsClassification"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, + key_vault_properties: "_models.KeyVaultProperties", + status: Union[str, "_models.EncryptionStatus"], + cosmos_db_resource_id: Optional[str] = None, + identity: Optional["_models.IdentityForCmk"] = None, + search_account_resource_id: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword cosmos_db_resource_id: The byok cosmosdb account that customer brings to store + customer's data + with encryption. + :paramtype cosmos_db_resource_id: str + :keyword identity: Identity to be used with the keyVault. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityForCmk + :keyword key_vault_properties: KeyVault details to do the encryption. Required. + :paramtype key_vault_properties: ~azure.mgmt.machinelearningservices.models.KeyVaultProperties + :keyword search_account_resource_id: The byok search account that customer brings to store + customer's data + with encryption. + :paramtype search_account_resource_id: str + :keyword status: Indicates whether or not the encryption is enabled for the workspace. + Required. Known values are: "Enabled" and "Disabled". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.EncryptionStatus + :keyword storage_account_resource_id: The byok storage account that customer brings to store + customer's data + with encryption. + :paramtype storage_account_resource_id: str """ - super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - **kwargs - ) - self.model_settings = model_settings - self.search_space = search_space + super().__init__(**kwargs) + self.cosmos_db_resource_id = cosmos_db_resource_id + self.identity = identity + self.key_vault_properties = key_vault_properties + self.search_account_resource_id = search_account_resource_id + self.status = status + self.storage_account_resource_id = storage_account_resource_id -class ImageClassification(ImageClassificationBase, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Image Classification. Multi-class image classification is used when an image is classified with - only a single label - from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' - or a 'duck'. +class EncryptionUpdateProperties(_serialization.Model): + """EncryptionUpdateProperties. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :ivar primary_metric: Primary metric to optimize for this task. Known values are: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and - "PrecisionScoreWeighted". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :ivar key_vault_properties: Required. + :vartype key_vault_properties: + ~azure.mgmt.machinelearningservices.models.EncryptionKeyVaultUpdateProperties """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + "key_vault_properties": {"required": True}, } _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, + "key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultUpdateProperties"}, + } + + def __init__(self, *, key_vault_properties: "_models.EncryptionKeyVaultUpdateProperties", **kwargs: Any) -> None: + """ + :keyword 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, *, - training_data: "_models.MLTableJobInput", - limit_settings: "_models.ImageLimitSettings", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsClassification"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, - primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, + protocol: Union[str, "_models.Protocol"] = "tcp", + name: Optional[str] = None, + target: Optional[int] = None, + published: Optional[int] = None, + host_ip: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :keyword primary_metric: Primary metric to optimize for this task. Known values are: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and - "PrecisionScoreWeighted". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + :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__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - model_settings=model_settings, - search_space=search_space, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "ImageClassification" - self.training_data = training_data - self.primary_metric = primary_metric - self.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.model_settings = model_settings - self.search_space = search_space - + super().__init__(**kwargs) + self.protocol = protocol + self.name = name + self.target = target + self.published = published + self.host_ip = host_ip -class ImageClassificationMultilabel( - ImageClassificationBase, AutoMLVertical -): # pylint: disable=too-many-instance-attributes - """Image Classification Multilabel. Multi-label image classification is used when an image could - have one or more labels - from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. - All required parameters must be populated in order to send to Azure. +class EndpointAuthKeys(_serialization.Model): + """Keys for endpoint authentication. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :ivar primary_metric: Primary metric to optimize for this task. Known values are: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted", and "IOU". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + :ivar primary_key: The primary key. + :vartype primary_key: str + :ivar secondary_key: The secondary key. + :vartype secondary_key: str """ - _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + _attribute_map = { + "primary_key": {"key": "primaryKey", "type": "str"}, + "secondary_key": {"key": "secondaryKey", "type": "str"}, } + def __init__( + self, *, primary_key: Optional[str] = None, secondary_key: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword primary_key: The primary key. + :paramtype primary_key: str + :keyword secondary_key: The secondary key. + :paramtype secondary_key: str + """ + super().__init__(**kwargs) + self.primary_key = primary_key + self.secondary_key = secondary_key + + +class EndpointAuthToken(_serialization.Model): + """Service Token. + + :ivar access_token: Access token for endpoint authentication. + :vartype access_token: str + :ivar expiry_time_utc: Access token expiry time (UTC). + :vartype expiry_time_utc: int + :ivar refresh_after_time_utc: Refresh access token after time (UTC). + :vartype refresh_after_time_utc: int + :ivar token_type: Access token type. + :vartype token_type: str + """ + _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, + "access_token": {"key": "accessToken", "type": "str"}, + "expiry_time_utc": {"key": "expiryTimeUtc", "type": "int"}, + "refresh_after_time_utc": {"key": "refreshAfterTimeUtc", "type": "int"}, + "token_type": {"key": "tokenType", "type": "str"}, } def __init__( self, *, - training_data: "_models.MLTableJobInput", - limit_settings: "_models.ImageLimitSettings", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsClassification"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, - primary_metric: Optional[Union[str, "_models.ClassificationMultilabelPrimaryMetrics"]] = None, + access_token: Optional[str] = None, + expiry_time_utc: int = 0, + refresh_after_time_utc: int = 0, + token_type: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] - :keyword primary_metric: Primary metric to optimize for this task. Known values are: - "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", - "PrecisionScoreWeighted", and "IOU". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + :keyword access_token: Access token for endpoint authentication. + :paramtype access_token: str + :keyword expiry_time_utc: Access token expiry time (UTC). + :paramtype expiry_time_utc: int + :keyword refresh_after_time_utc: Refresh access token after time (UTC). + :paramtype refresh_after_time_utc: int + :keyword token_type: Access token type. + :paramtype token_type: str """ - super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - model_settings=model_settings, - search_space=search_space, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "ImageClassificationMultilabel" - self.training_data = training_data - self.primary_metric = primary_metric - self.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.model_settings = model_settings - self.search_space = search_space - + super().__init__(**kwargs) + self.access_token = access_token + self.expiry_time_utc = expiry_time_utc + self.refresh_after_time_utc = refresh_after_time_utc + self.token_type = token_type -class ImageObjectDetectionBase(ImageVertical): - """ImageObjectDetectionBase. - All required parameters must be populated in order to send to Azure. +class EndpointDeploymentModel(_serialization.Model): + """EndpointDeploymentModel. - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar format: Model format. + :vartype format: str + :ivar name: Model name. + :vartype name: str + :ivar source: Optional. Deployment model source ARM resource ID. + :vartype source: str + :ivar version: Model version. + :vartype version: str """ - _validation = { - "limit_settings": {"required": True}, - } - _attribute_map = { - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, + "format": {"key": "format", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "source": {"key": "source", "type": "str"}, + "version": {"key": "version", "type": "str"}, } def __init__( self, *, - limit_settings: "_models.ImageLimitSettings", - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, + format: Optional[str] = None, + name: Optional[str] = None, + source: Optional[str] = None, + version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword format: Model format. + :paramtype format: str + :keyword name: Model name. + :paramtype name: str + :keyword source: Optional. Deployment model source ARM resource ID. + :paramtype source: str + :keyword version: Model version. + :paramtype version: str """ - super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - **kwargs - ) - self.model_settings = model_settings - self.search_space = search_space + super().__init__(**kwargs) + self.format = format + self.name = name + self.source = source + self.version = version -class ImageInstanceSegmentation( - ImageObjectDetectionBase, AutoMLVertical -): # pylint: disable=too-many-instance-attributes - """Image Instance Segmentation. Instance segmentation is used to identify objects in an image at - the pixel level, - drawing a polygon around each object in the image. +class EndpointDeploymentResourcePropertiesBasicResource(Resource): # pylint: disable=name-too-long + """EndpointDeploymentResourcePropertiesBasicResource. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :ivar primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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. + :vartype properties: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, - "primary_metric": {"key": "primaryMetric", "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": "EndpointDeploymentResourceProperties"}, + } + + def __init__(self, *, properties: "_models.EndpointDeploymentResourceProperties", **kwargs: Any) -> None: + """ + :keyword properties: Required. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult( + _serialization.Model +): # pylint: disable=name-too-long + """EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult. + + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, } def __init__( self, *, - training_data: "_models.MLTableJobInput", - limit_settings: "_models.ImageLimitSettings", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - sweep_settings: Optional["_models.ImageSweepSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, - primary_metric: Optional[Union[str, "_models.InstanceSegmentationPrimaryMetrics"]] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, **kwargs: Any ) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :keyword primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] """ - super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - model_settings=model_settings, - search_space=search_space, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "ImageInstanceSegmentation" - self.training_data = training_data - self.primary_metric = primary_metric - self.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.model_settings = model_settings - self.search_space = search_space + super().__init__(**kwargs) + self.next_link = next_link + self.value = value -class ImageLimitSettings(_serialization.Model): - """Limit settings for the AutoML job. +class EndpointKeys(_serialization.Model): + """EndpointKeys. - :ivar max_concurrent_trials: Maximum number of concurrent AutoML iterations. - :vartype max_concurrent_trials: int - :ivar max_trials: Maximum number of AutoML iterations. - :vartype max_trials: int - :ivar timeout: AutoML job timeout. - :vartype timeout: ~datetime.timedelta + :ivar keys: Dictionary of Keys for the endpoint. + :vartype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ _attribute_map = { - "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, - "max_trials": {"key": "maxTrials", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "keys": {"key": "keys", "type": "AccountApiKeys"}, } - def __init__( - self, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any - ) -> None: + def __init__(self, *, keys: Optional["_models.AccountApiKeys"] = None, **kwargs: Any) -> None: """ - :keyword max_concurrent_trials: Maximum number of concurrent AutoML iterations. - :paramtype max_concurrent_trials: int - :keyword max_trials: Maximum number of AutoML iterations. - :paramtype max_trials: int - :keyword timeout: AutoML job timeout. - :paramtype timeout: ~datetime.timedelta + :keyword keys: Dictionary of Keys for the endpoint. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.AccountApiKeys """ super().__init__(**kwargs) - self.max_concurrent_trials = max_concurrent_trials - self.max_trials = max_trials - self.timeout = timeout + self.keys = keys -class ImageMetadata(_serialization.Model): - """Returns metadata about the operating system image for this compute instance. +class EndpointModelDeprecationProperties(_serialization.Model): + """EndpointModelDeprecationProperties. - :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 + :ivar fine_tune: The datetime of deprecation of the fineTune Model. + :vartype fine_tune: ~datetime.datetime + :ivar inference: The datetime of deprecation of the inference Model. + :vartype inference: ~datetime.datetime """ _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"}, + "fine_tune": {"key": "fineTune", "type": "iso-8601"}, + "inference": {"key": "inference", "type": "iso-8601"}, } def __init__( self, *, - current_image_version: Optional[str] = None, - latest_image_version: Optional[str] = None, - is_latest_os_image_version: Optional[bool] = None, + fine_tune: Optional[datetime.datetime] = None, + inference: Optional[datetime.datetime] = None, **kwargs: Any ) -> None: """ - :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 + :keyword fine_tune: The datetime of deprecation of the fineTune Model. + :paramtype fine_tune: ~datetime.datetime + :keyword inference: The datetime of deprecation of the inference Model. + :paramtype inference: ~datetime.datetime """ 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 + self.fine_tune = fine_tune + self.inference = inference -class ImageModelDistributionSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. +class EndpointModelProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Endpoint Model properties. - :code:` - Some examples are: - ``` - ModelName = "choice('seresnext', 'resnest50')"; - LearningRate = "uniform(0.001, 0.01)"; - LayersToFreeze = "choice(0, 2)"; - ```` - All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., - valn) - where distribution name can be: uniform, quniform, loguniform, etc - For more details on how to compose distribution expressions please check the documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str + :ivar capabilities: The capabilities. + :vartype capabilities: dict[str, str] + :ivar deprecation: + :vartype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :ivar finetune_capabilities: The capabilities for finetune models. + :vartype finetune_capabilities: dict[str, str] + :ivar format: Deployment model format. + :vartype format: str + :ivar is_default_version: If the model is default version. + :vartype is_default_version: bool + :ivar lifecycle_status: Model lifecycle status. Known values are: "GenerallyAvailable" and + "Preview". + :vartype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :ivar max_capacity: The max capacity. + :vartype max_capacity: int + :ivar name: Deployment model name. + :vartype name: str + :ivar skus: The list of Model Sku. + :vartype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData + :ivar version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :vartype version: str """ + _validation = { + "system_data": {"readonly": True}, + } + _attribute_map = { - "ams_gradient": {"key": "amsGradient", "type": "str"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "str"}, - "beta2": {"key": "beta2", "type": "str"}, - "distributed": {"key": "distributed", "type": "str"}, - "early_stopping": {"key": "earlyStopping", "type": "str"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, - "learning_rate": {"key": "learningRate", "type": "str"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "str"}, - "nesterov": {"key": "nesterov", "type": "str"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "str"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, - "weight_decay": {"key": "weightDecay", "type": "str"}, + "capabilities": {"key": "capabilities", "type": "{str}"}, + "deprecation": {"key": "deprecation", "type": "EndpointModelDeprecationProperties"}, + "finetune_capabilities": {"key": "finetuneCapabilities", "type": "{str}"}, + "format": {"key": "format", "type": "str"}, + "is_default_version": {"key": "isDefaultVersion", "type": "bool"}, + "lifecycle_status": {"key": "lifecycleStatus", "type": "str"}, + "max_capacity": {"key": "maxCapacity", "type": "int"}, + "name": {"key": "name", "type": "str"}, + "skus": {"key": "skus", "type": "[EndpointModelSkuProperties]"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "version": {"key": "version", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - ams_gradient: Optional[str] = None, - augmentations: Optional[str] = None, - beta1: Optional[str] = None, - beta2: Optional[str] = None, - distributed: Optional[str] = None, - early_stopping: Optional[str] = None, - early_stopping_delay: Optional[str] = None, - early_stopping_patience: Optional[str] = None, - enable_onnx_normalization: Optional[str] = None, - evaluation_frequency: Optional[str] = None, - gradient_accumulation_step: Optional[str] = None, - layers_to_freeze: Optional[str] = None, - learning_rate: Optional[str] = None, - learning_rate_scheduler: Optional[str] = None, - model_name: Optional[str] = None, - momentum: Optional[str] = None, - nesterov: Optional[str] = None, - number_of_epochs: Optional[str] = None, - number_of_workers: Optional[str] = None, - optimizer: Optional[str] = None, - random_seed: Optional[str] = None, - step_lr_gamma: Optional[str] = None, - step_lr_step_size: Optional[str] = None, - training_batch_size: Optional[str] = None, - validation_batch_size: Optional[str] = None, - warmup_cosine_lr_cycles: Optional[str] = None, - warmup_cosine_lr_warmup_epochs: Optional[str] = None, - weight_decay: Optional[str] = None, + capabilities: Optional[Dict[str, str]] = None, + deprecation: Optional["_models.EndpointModelDeprecationProperties"] = None, + finetune_capabilities: Optional[Dict[str, str]] = None, + format: Optional[str] = None, + is_default_version: Optional[bool] = None, + lifecycle_status: Optional[Union[str, "_models.ModelLifecycleStatus"]] = None, + max_capacity: Optional[int] = None, + name: Optional[str] = None, + skus: Optional[List["_models.EndpointModelSkuProperties"]] = None, + version: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str + :keyword capabilities: The capabilities. + :paramtype capabilities: dict[str, str] + :keyword deprecation: + :paramtype deprecation: + ~azure.mgmt.machinelearningservices.models.EndpointModelDeprecationProperties + :keyword finetune_capabilities: The capabilities for finetune models. + :paramtype finetune_capabilities: dict[str, str] + :keyword format: Deployment model format. + :paramtype format: str + :keyword is_default_version: If the model is default version. + :paramtype is_default_version: bool + :keyword lifecycle_status: Model lifecycle status. Known values are: "GenerallyAvailable" and + "Preview". + :paramtype lifecycle_status: str or + ~azure.mgmt.machinelearningservices.models.ModelLifecycleStatus + :keyword max_capacity: The max capacity. + :paramtype max_capacity: int + :keyword name: Deployment model name. + :paramtype name: str + :keyword skus: The list of Model Sku. + :paramtype skus: list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuProperties] + :keyword version: Optional. Deployment model version. If version is not specified, a default + version will be assigned. The default version is different for different models and might + change when there is new version available for a model. Default version for a model could be + found from list models API. + :paramtype version: str """ super().__init__(**kwargs) - self.ams_gradient = ams_gradient - self.augmentations = augmentations - self.beta1 = beta1 - self.beta2 = beta2 - self.distributed = distributed - self.early_stopping = early_stopping - self.early_stopping_delay = early_stopping_delay - self.early_stopping_patience = early_stopping_patience - self.enable_onnx_normalization = enable_onnx_normalization - self.evaluation_frequency = evaluation_frequency - self.gradient_accumulation_step = gradient_accumulation_step - self.layers_to_freeze = layers_to_freeze - self.learning_rate = learning_rate - self.learning_rate_scheduler = learning_rate_scheduler - self.model_name = model_name - self.momentum = momentum - self.nesterov = nesterov - self.number_of_epochs = number_of_epochs - self.number_of_workers = number_of_workers - self.optimizer = optimizer - self.random_seed = random_seed - self.step_lr_gamma = step_lr_gamma - self.step_lr_step_size = step_lr_step_size - self.training_batch_size = training_batch_size - self.validation_batch_size = validation_batch_size - self.warmup_cosine_lr_cycles = warmup_cosine_lr_cycles - self.warmup_cosine_lr_warmup_epochs = warmup_cosine_lr_warmup_epochs - self.weight_decay = weight_decay + self.capabilities = capabilities + self.deprecation = deprecation + self.finetune_capabilities = finetune_capabilities + self.format = format + self.is_default_version = is_default_version + self.lifecycle_status = lifecycle_status + self.max_capacity = max_capacity + self.name = name + self.skus = skus + self.system_data = None + self.version = version -class ImageModelDistributionSettingsClassification( - ImageModelDistributionSettings -): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. +class EndpointModels(_serialization.Model): + """EndpointModels. - :code:` - Some examples are: - ``` - ModelName = "choice('seresnext', 'resnest50')"; - LearningRate = "uniform(0.001, 0.01)"; - LayersToFreeze = "choice(0, 2)"; - ```` - For more details on how to compose distribution expressions please check the documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: List of models. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + """ - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str - :ivar training_crop_size: Image crop size that is input to the neural network for the training - dataset. Must be a positive integer. - :vartype training_crop_size: str - :ivar validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :vartype validation_crop_size: str - :ivar validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :vartype validation_resize_size: str - :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :vartype weighted_loss: str + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EndpointModelProperties]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.EndpointModelProperties"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str + :keyword value: List of models. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class EndpointModelSkuCapacityProperties(_serialization.Model): + """EndpointModelSkuCapacityProperties. + + :ivar default: The default capacity. + :vartype default: int + :ivar maximum: The maximum capacity. + :vartype maximum: int """ _attribute_map = { - "ams_gradient": {"key": "amsGradient", "type": "str"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "str"}, - "beta2": {"key": "beta2", "type": "str"}, - "distributed": {"key": "distributed", "type": "str"}, - "early_stopping": {"key": "earlyStopping", "type": "str"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, - "learning_rate": {"key": "learningRate", "type": "str"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "str"}, - "nesterov": {"key": "nesterov", "type": "str"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "str"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, - "weight_decay": {"key": "weightDecay", "type": "str"}, - "training_crop_size": {"key": "trainingCropSize", "type": "str"}, - "validation_crop_size": {"key": "validationCropSize", "type": "str"}, - "validation_resize_size": {"key": "validationResizeSize", "type": "str"}, - "weighted_loss": {"key": "weightedLoss", "type": "str"}, + "default": {"key": "default", "type": "int"}, + "maximum": {"key": "maximum", "type": "int"}, } - def __init__( # pylint: disable=too-many-locals + def __init__(self, *, default: Optional[int] = None, maximum: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword default: The default capacity. + :paramtype default: int + :keyword maximum: The maximum capacity. + :paramtype maximum: int + """ + super().__init__(**kwargs) + self.default = default + self.maximum = maximum + + +class EndpointModelSkuProperties(_serialization.Model): + """EndpointModelSkuProperties. + + :ivar capacity: + :vartype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :ivar connection_ids: The list of ARM id for the connection support this SKU. + :vartype connection_ids: list[str] + :ivar deprecation_date: The datetime of deprecation of the model SKU. + :vartype deprecation_date: ~datetime.datetime + :ivar name: The name of the model SKU. + :vartype name: str + :ivar rate_limits: + :vartype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :ivar usage_name: The usage name of the model SKU. + :vartype usage_name: str + """ + + _attribute_map = { + "capacity": {"key": "capacity", "type": "EndpointModelSkuCapacityProperties"}, + "connection_ids": {"key": "connectionIds", "type": "[str]"}, + "deprecation_date": {"key": "deprecationDate", "type": "iso-8601"}, + "name": {"key": "name", "type": "str"}, + "rate_limits": {"key": "rateLimits", "type": "[EndpointModelSkuRateLimitProperties]"}, + "usage_name": {"key": "usageName", "type": "str"}, + } + + def __init__( self, *, - ams_gradient: Optional[str] = None, - augmentations: Optional[str] = None, - beta1: Optional[str] = None, - beta2: Optional[str] = None, - distributed: Optional[str] = None, - early_stopping: Optional[str] = None, - early_stopping_delay: Optional[str] = None, - early_stopping_patience: Optional[str] = None, - enable_onnx_normalization: Optional[str] = None, - evaluation_frequency: Optional[str] = None, - gradient_accumulation_step: Optional[str] = None, - layers_to_freeze: Optional[str] = None, - learning_rate: Optional[str] = None, - learning_rate_scheduler: Optional[str] = None, - model_name: Optional[str] = None, - momentum: Optional[str] = None, - nesterov: Optional[str] = None, - number_of_epochs: Optional[str] = None, - number_of_workers: Optional[str] = None, - optimizer: Optional[str] = None, - random_seed: Optional[str] = None, - step_lr_gamma: Optional[str] = None, - step_lr_step_size: Optional[str] = None, - training_batch_size: Optional[str] = None, - validation_batch_size: Optional[str] = None, - warmup_cosine_lr_cycles: Optional[str] = None, - warmup_cosine_lr_warmup_epochs: Optional[str] = None, - weight_decay: Optional[str] = None, - training_crop_size: Optional[str] = None, - validation_crop_size: Optional[str] = None, - validation_resize_size: Optional[str] = None, - weighted_loss: Optional[str] = None, + capacity: Optional["_models.EndpointModelSkuCapacityProperties"] = None, + connection_ids: Optional[List[str]] = None, + deprecation_date: Optional[datetime.datetime] = None, + name: Optional[str] = None, + rate_limits: Optional[List["_models.EndpointModelSkuRateLimitProperties"]] = None, + usage_name: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str - :keyword training_crop_size: Image crop size that is input to the neural network for the - training dataset. Must be a positive integer. - :paramtype training_crop_size: str - :keyword validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :paramtype validation_crop_size: str - :keyword validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :paramtype validation_resize_size: str - :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :paramtype weighted_loss: str + :keyword capacity: + :paramtype capacity: + ~azure.mgmt.machinelearningservices.models.EndpointModelSkuCapacityProperties + :keyword connection_ids: The list of ARM id for the connection support this SKU. + :paramtype connection_ids: list[str] + :keyword deprecation_date: The datetime of deprecation of the model SKU. + :paramtype deprecation_date: ~datetime.datetime + :keyword name: The name of the model SKU. + :paramtype name: str + :keyword rate_limits: + :paramtype rate_limits: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitProperties] + :keyword usage_name: The usage name of the model SKU. + :paramtype usage_name: str """ - super().__init__( - ams_gradient=ams_gradient, - augmentations=augmentations, - beta1=beta1, - beta2=beta2, - distributed=distributed, - early_stopping=early_stopping, - early_stopping_delay=early_stopping_delay, - early_stopping_patience=early_stopping_patience, - enable_onnx_normalization=enable_onnx_normalization, - evaluation_frequency=evaluation_frequency, - gradient_accumulation_step=gradient_accumulation_step, - layers_to_freeze=layers_to_freeze, - learning_rate=learning_rate, - learning_rate_scheduler=learning_rate_scheduler, - model_name=model_name, - momentum=momentum, - nesterov=nesterov, - number_of_epochs=number_of_epochs, - number_of_workers=number_of_workers, - optimizer=optimizer, - random_seed=random_seed, - step_lr_gamma=step_lr_gamma, - step_lr_step_size=step_lr_step_size, - training_batch_size=training_batch_size, - validation_batch_size=validation_batch_size, - warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, - warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, - weight_decay=weight_decay, - **kwargs - ) - self.training_crop_size = training_crop_size - self.validation_crop_size = validation_crop_size - self.validation_resize_size = validation_resize_size - self.weighted_loss = weighted_loss - + super().__init__(**kwargs) + self.capacity = capacity + self.connection_ids = connection_ids + self.deprecation_date = deprecation_date + self.name = name + self.rate_limits = rate_limits + self.usage_name = usage_name -class ImageModelDistributionSettingsObjectDetection( - ImageModelDistributionSettings -): # pylint: disable=too-many-instance-attributes - """Distribution expressions to sweep over values of model settings. - :code:` - Some examples are: - ``` - ModelName = "choice('seresnext', 'resnest50')"; - LearningRate = "uniform(0.001, 0.01)"; - LayersToFreeze = "choice(0, 2)"; - ```` - For more details on how to compose distribution expressions please check the documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class EndpointModelSkuRateLimitProperties(_serialization.Model): + """EndpointModelSkuRateLimitProperties. - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: str - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: str - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: str - :ivar distributed: Whether to use distributer training. - :vartype distributed: str - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: str - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: str - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: str - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: str - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: str - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: str - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: str - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: str - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :vartype learning_rate_scheduler: str - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: str - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: str - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: str - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: str - :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :vartype optimizer: str - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: str - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: str - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: str - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: str - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: str - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: str - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: str - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: str - :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must - be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype box_detections_per_image: str - :ivar box_score_threshold: During inference, only return proposals with a classification score - greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :vartype box_score_threshold: str - :ivar image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype image_size: str - :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype max_size: str - :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype min_size: str - :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype model_size: str - :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype multi_scale: str - :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - float in the range [0, 1]. - :vartype nms_iou_threshold: str - :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not - be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_grid_size: str - :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float - in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_overlap_ratio: str - :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - NMS: Non-maximum suppression. - :vartype tile_predictions_nms_threshold: str - :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be - float in the range [0, 1]. - :vartype validation_iou_threshold: str - :ivar validation_metric_type: Metric computation method to use for validation metrics. Must be - 'none', 'coco', 'voc', or 'coco_voc'. - :vartype validation_metric_type: str + :ivar count: The count value of Call Rate Limit. + :vartype count: float + :ivar renewal_period: The renewal period in seconds of Call Rate Limit. + :vartype renewal_period: float + :ivar rules: The call rate limit for the model. + :vartype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ _attribute_map = { - "ams_gradient": {"key": "amsGradient", "type": "str"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "str"}, - "beta2": {"key": "beta2", "type": "str"}, - "distributed": {"key": "distributed", "type": "str"}, - "early_stopping": {"key": "earlyStopping", "type": "str"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, - "learning_rate": {"key": "learningRate", "type": "str"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "str"}, - "nesterov": {"key": "nesterov", "type": "str"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "str"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, - "weight_decay": {"key": "weightDecay", "type": "str"}, - "box_detections_per_image": {"key": "boxDetectionsPerImage", "type": "str"}, - "box_score_threshold": {"key": "boxScoreThreshold", "type": "str"}, - "image_size": {"key": "imageSize", "type": "str"}, - "max_size": {"key": "maxSize", "type": "str"}, - "min_size": {"key": "minSize", "type": "str"}, - "model_size": {"key": "modelSize", "type": "str"}, - "multi_scale": {"key": "multiScale", "type": "str"}, - "nms_iou_threshold": {"key": "nmsIouThreshold", "type": "str"}, - "tile_grid_size": {"key": "tileGridSize", "type": "str"}, - "tile_overlap_ratio": {"key": "tileOverlapRatio", "type": "str"}, - "tile_predictions_nms_threshold": {"key": "tilePredictionsNmsThreshold", "type": "str"}, - "validation_iou_threshold": {"key": "validationIouThreshold", "type": "str"}, - "validation_metric_type": {"key": "validationMetricType", "type": "str"}, + "count": {"key": "count", "type": "float"}, + "renewal_period": {"key": "renewalPeriod", "type": "float"}, + "rules": {"key": "rules", "type": "[EndpointModelSkuRateLimitRuleProperties]"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, *, - ams_gradient: Optional[str] = None, - augmentations: Optional[str] = None, - beta1: Optional[str] = None, - beta2: Optional[str] = None, - distributed: Optional[str] = None, - early_stopping: Optional[str] = None, - early_stopping_delay: Optional[str] = None, - early_stopping_patience: Optional[str] = None, - enable_onnx_normalization: Optional[str] = None, - evaluation_frequency: Optional[str] = None, - gradient_accumulation_step: Optional[str] = None, - layers_to_freeze: Optional[str] = None, - learning_rate: Optional[str] = None, - learning_rate_scheduler: Optional[str] = None, - model_name: Optional[str] = None, - momentum: Optional[str] = None, - nesterov: Optional[str] = None, - number_of_epochs: Optional[str] = None, - number_of_workers: Optional[str] = None, - optimizer: Optional[str] = None, - random_seed: Optional[str] = None, - step_lr_gamma: Optional[str] = None, - step_lr_step_size: Optional[str] = None, - training_batch_size: Optional[str] = None, - validation_batch_size: Optional[str] = None, - warmup_cosine_lr_cycles: Optional[str] = None, - warmup_cosine_lr_warmup_epochs: Optional[str] = None, - weight_decay: Optional[str] = None, - box_detections_per_image: Optional[str] = None, - box_score_threshold: Optional[str] = None, - image_size: Optional[str] = None, - max_size: Optional[str] = None, - min_size: Optional[str] = None, - model_size: Optional[str] = None, - multi_scale: Optional[str] = None, - nms_iou_threshold: Optional[str] = None, - tile_grid_size: Optional[str] = None, - tile_overlap_ratio: Optional[str] = None, - tile_predictions_nms_threshold: Optional[str] = None, - validation_iou_threshold: Optional[str] = None, - validation_metric_type: Optional[str] = None, + count: Optional[float] = None, + renewal_period: Optional[float] = None, + rules: Optional[List["_models.EndpointModelSkuRateLimitRuleProperties"]] = None, **kwargs: Any ) -> None: """ - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: str - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: str - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: str - :keyword distributed: Whether to use distributer training. - :paramtype distributed: str - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: str - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: str - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: str - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: str - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: str - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: str - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: str - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: str - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. - :paramtype learning_rate_scheduler: str - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: str - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: str - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: str - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: str - :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. - :paramtype optimizer: str - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: str - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: str - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: str - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: str - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: str - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: str - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: str - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: str - :keyword box_detections_per_image: Maximum number of detections per image, for all classes. - Must be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype box_detections_per_image: str - :keyword box_score_threshold: During inference, only return proposals with a classification - score greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :paramtype box_score_threshold: str - :keyword image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype image_size: str - :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype max_size: str - :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype min_size: str - :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype model_size: str - :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype multi_scale: str - :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - float in the range [0, 1]. - :paramtype nms_iou_threshold: str - :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must - not be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_grid_size: str - :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be - float in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_overlap_ratio: str - :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - NMS: Non-maximum suppression. - :paramtype tile_predictions_nms_threshold: str - :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must - be float in the range [0, 1]. - :paramtype validation_iou_threshold: str - :keyword validation_metric_type: Metric computation method to use for validation metrics. Must - be 'none', 'coco', 'voc', or 'coco_voc'. - :paramtype validation_metric_type: str + :keyword count: The count value of Call Rate Limit. + :paramtype count: float + :keyword renewal_period: The renewal period in seconds of Call Rate Limit. + :paramtype renewal_period: float + :keyword rules: The call rate limit for the model. + :paramtype rules: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRuleProperties] """ - super().__init__( - ams_gradient=ams_gradient, - augmentations=augmentations, - beta1=beta1, - beta2=beta2, - distributed=distributed, - early_stopping=early_stopping, - early_stopping_delay=early_stopping_delay, - early_stopping_patience=early_stopping_patience, - enable_onnx_normalization=enable_onnx_normalization, - evaluation_frequency=evaluation_frequency, - gradient_accumulation_step=gradient_accumulation_step, - layers_to_freeze=layers_to_freeze, - learning_rate=learning_rate, - learning_rate_scheduler=learning_rate_scheduler, - model_name=model_name, - momentum=momentum, - nesterov=nesterov, - number_of_epochs=number_of_epochs, - number_of_workers=number_of_workers, - optimizer=optimizer, - random_seed=random_seed, - step_lr_gamma=step_lr_gamma, - step_lr_step_size=step_lr_step_size, - training_batch_size=training_batch_size, - validation_batch_size=validation_batch_size, - warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, - warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, - weight_decay=weight_decay, - **kwargs - ) - self.box_detections_per_image = box_detections_per_image - self.box_score_threshold = box_score_threshold - self.image_size = image_size - self.max_size = max_size - self.min_size = min_size - self.model_size = model_size - self.multi_scale = multi_scale - self.nms_iou_threshold = nms_iou_threshold - self.tile_grid_size = tile_grid_size - self.tile_overlap_ratio = tile_overlap_ratio - self.tile_predictions_nms_threshold = tile_predictions_nms_threshold - self.validation_iou_threshold = validation_iou_threshold - self.validation_metric_type = validation_metric_type + super().__init__(**kwargs) + self.count = count + self.renewal_period = renewal_period + self.rules = rules -class ImageModelSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Settings used for training the model. - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class EndpointModelSkuRateLimitRulePatternProperties(_serialization.Model): # pylint: disable=name-too-long + """EndpointModelSkuRateLimitRulePatternProperties. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float + :ivar method: + :vartype method: str + :ivar path: + :vartype path: str """ _attribute_map = { - "advanced_settings": {"key": "advancedSettings", "type": "str"}, - "ams_gradient": {"key": "amsGradient", "type": "bool"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "float"}, - "beta2": {"key": "beta2", "type": "float"}, - "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, - "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, - "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, - "distributed": {"key": "distributed", "type": "bool"}, - "early_stopping": {"key": "earlyStopping", "type": "bool"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, - "learning_rate": {"key": "learningRate", "type": "float"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "float"}, - "nesterov": {"key": "nesterov", "type": "bool"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "int"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, - "weight_decay": {"key": "weightDecay", "type": "float"}, + "method": {"key": "method", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + def __init__(self, *, method: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword method: + :paramtype method: str + :keyword path: + :paramtype path: str + """ + super().__init__(**kwargs) + self.method = method + self.path = path + + +class EndpointModelSkuRateLimitRuleProperties(_serialization.Model): + """EndpointModelSkuRateLimitRuleProperties. + + :ivar count: + :vartype count: float + :ivar dynamic_throttling_enabled: If the dynamic throttling is enabled. + :vartype dynamic_throttling_enabled: bool + :ivar key: + :vartype key: str + :ivar match_patterns: + :vartype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :ivar min_count: + :vartype min_count: float + :ivar renewal_period: + :vartype renewal_period: float + """ + + _attribute_map = { + "count": {"key": "count", "type": "float"}, + "dynamic_throttling_enabled": {"key": "dynamicThrottlingEnabled", "type": "bool"}, + "key": {"key": "key", "type": "str"}, + "match_patterns": {"key": "matchPatterns", "type": "[EndpointModelSkuRateLimitRulePatternProperties]"}, + "min_count": {"key": "minCount", "type": "float"}, + "renewal_period": {"key": "renewalPeriod", "type": "float"}, + } + + def __init__( self, *, - advanced_settings: Optional[str] = None, - ams_gradient: Optional[bool] = None, - augmentations: Optional[str] = None, - beta1: Optional[float] = None, - beta2: Optional[float] = None, - checkpoint_frequency: Optional[int] = None, - checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, - checkpoint_run_id: Optional[str] = None, - distributed: Optional[bool] = None, - early_stopping: Optional[bool] = None, - early_stopping_delay: Optional[int] = None, - early_stopping_patience: Optional[int] = None, - enable_onnx_normalization: Optional[bool] = None, - evaluation_frequency: Optional[int] = None, - gradient_accumulation_step: Optional[int] = None, - layers_to_freeze: Optional[int] = None, - learning_rate: Optional[float] = None, - learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, - model_name: Optional[str] = None, - momentum: Optional[float] = None, - nesterov: Optional[bool] = None, - number_of_epochs: Optional[int] = None, - number_of_workers: Optional[int] = None, - optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, - random_seed: Optional[int] = None, - step_lr_gamma: Optional[float] = None, - step_lr_step_size: Optional[int] = None, - training_batch_size: Optional[int] = None, - validation_batch_size: Optional[int] = None, - warmup_cosine_lr_cycles: Optional[float] = None, - warmup_cosine_lr_warmup_epochs: Optional[int] = None, - weight_decay: Optional[float] = None, + count: Optional[float] = None, + dynamic_throttling_enabled: Optional[bool] = None, + key: Optional[str] = None, + match_patterns: Optional[List["_models.EndpointModelSkuRateLimitRulePatternProperties"]] = None, + min_count: Optional[float] = None, + renewal_period: Optional[float] = None, **kwargs: Any ) -> None: """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float + :keyword count: + :paramtype count: float + :keyword dynamic_throttling_enabled: If the dynamic throttling is enabled. + :paramtype dynamic_throttling_enabled: bool + :keyword key: + :paramtype key: str + :keyword match_patterns: + :paramtype match_patterns: + list[~azure.mgmt.machinelearningservices.models.EndpointModelSkuRateLimitRulePatternProperties] + :keyword min_count: + :paramtype min_count: float + :keyword renewal_period: + :paramtype renewal_period: float """ super().__init__(**kwargs) - self.advanced_settings = advanced_settings - self.ams_gradient = ams_gradient - self.augmentations = augmentations - self.beta1 = beta1 - self.beta2 = beta2 - self.checkpoint_frequency = checkpoint_frequency - self.checkpoint_model = checkpoint_model - self.checkpoint_run_id = checkpoint_run_id - self.distributed = distributed - self.early_stopping = early_stopping - self.early_stopping_delay = early_stopping_delay - self.early_stopping_patience = early_stopping_patience - self.enable_onnx_normalization = enable_onnx_normalization - self.evaluation_frequency = evaluation_frequency - self.gradient_accumulation_step = gradient_accumulation_step - self.layers_to_freeze = layers_to_freeze - self.learning_rate = learning_rate - self.learning_rate_scheduler = learning_rate_scheduler - self.model_name = model_name - self.momentum = momentum - self.nesterov = nesterov - self.number_of_epochs = number_of_epochs - self.number_of_workers = number_of_workers - self.optimizer = optimizer - self.random_seed = random_seed - self.step_lr_gamma = step_lr_gamma - self.step_lr_step_size = step_lr_step_size - self.training_batch_size = training_batch_size - self.validation_batch_size = validation_batch_size - self.warmup_cosine_lr_cycles = warmup_cosine_lr_cycles - self.warmup_cosine_lr_warmup_epochs = warmup_cosine_lr_warmup_epochs - self.weight_decay = weight_decay + self.count = count + self.dynamic_throttling_enabled = dynamic_throttling_enabled + self.key = key + self.match_patterns = match_patterns + self.min_count = min_count + self.renewal_period = renewal_period -class ImageModelSettingsClassification(ImageModelSettings): # pylint: disable=too-many-instance-attributes - """Settings used for training the model. - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class EndpointResourcePropertiesBasicResource(Resource): + """EndpointResourcePropertiesBasicResource. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float - :ivar training_crop_size: Image crop size that is input to the neural network for the training - dataset. Must be a positive integer. - :vartype training_crop_size: int - :ivar validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :vartype validation_crop_size: int - :ivar validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :vartype validation_resize_size: int - :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :vartype weighted_loss: int + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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. + :vartype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, + } + _attribute_map = { - "advanced_settings": {"key": "advancedSettings", "type": "str"}, - "ams_gradient": {"key": "amsGradient", "type": "bool"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "float"}, - "beta2": {"key": "beta2", "type": "float"}, - "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, - "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, - "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, - "distributed": {"key": "distributed", "type": "bool"}, - "early_stopping": {"key": "earlyStopping", "type": "bool"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, - "learning_rate": {"key": "learningRate", "type": "float"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "float"}, - "nesterov": {"key": "nesterov", "type": "bool"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "int"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, - "weight_decay": {"key": "weightDecay", "type": "float"}, - "training_crop_size": {"key": "trainingCropSize", "type": "int"}, - "validation_crop_size": {"key": "validationCropSize", "type": "int"}, - "validation_resize_size": {"key": "validationResizeSize", "type": "int"}, - "weighted_loss": {"key": "weightedLoss", "type": "int"}, + "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": "EndpointResourceProperties"}, } - def __init__( # pylint: disable=too-many-locals + def __init__(self, *, properties: "_models.EndpointResourceProperties", **kwargs: Any) -> None: + """ + :keyword properties: Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EndpointResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EndpointResourcePropertiesBasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """EndpointResourcePropertiesBasicResourceArmPaginatedResult. + + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EndpointResourcePropertiesBasicResource]"}, + } + + def __init__( self, *, - advanced_settings: Optional[str] = None, - ams_gradient: Optional[bool] = None, - augmentations: Optional[str] = None, - beta1: Optional[float] = None, - beta2: Optional[float] = None, - checkpoint_frequency: Optional[int] = None, - checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, - checkpoint_run_id: Optional[str] = None, - distributed: Optional[bool] = None, - early_stopping: Optional[bool] = None, - early_stopping_delay: Optional[int] = None, - early_stopping_patience: Optional[int] = None, - enable_onnx_normalization: Optional[bool] = None, - evaluation_frequency: Optional[int] = None, - gradient_accumulation_step: Optional[int] = None, - layers_to_freeze: Optional[int] = None, - learning_rate: Optional[float] = None, - learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, - model_name: Optional[str] = None, - momentum: Optional[float] = None, - nesterov: Optional[bool] = None, - number_of_epochs: Optional[int] = None, - number_of_workers: Optional[int] = None, - optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, - random_seed: Optional[int] = None, - step_lr_gamma: Optional[float] = None, - step_lr_step_size: Optional[int] = None, - training_batch_size: Optional[int] = None, - validation_batch_size: Optional[int] = None, - warmup_cosine_lr_cycles: Optional[float] = None, - warmup_cosine_lr_warmup_epochs: Optional[int] = None, - weight_decay: Optional[float] = None, - training_crop_size: Optional[int] = None, - validation_crop_size: Optional[int] = None, - validation_resize_size: Optional[int] = None, - weighted_loss: Optional[int] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.EndpointResourcePropertiesBasicResource"]] = None, **kwargs: Any ) -> None: """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float - :keyword training_crop_size: Image crop size that is input to the neural network for the - training dataset. Must be a positive integer. - :paramtype training_crop_size: int - :keyword validation_crop_size: Image crop size that is input to the neural network for the - validation dataset. Must be a positive integer. - :paramtype validation_crop_size: int - :keyword validation_resize_size: Image size to which to resize before cropping for validation - dataset. Must be a positive integer. - :paramtype validation_resize_size: int - :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. - 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be - 0 or 1 or 2. - :paramtype weighted_loss: int + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] """ - super().__init__( - advanced_settings=advanced_settings, - ams_gradient=ams_gradient, - augmentations=augmentations, - beta1=beta1, - beta2=beta2, - checkpoint_frequency=checkpoint_frequency, - checkpoint_model=checkpoint_model, - checkpoint_run_id=checkpoint_run_id, - distributed=distributed, - early_stopping=early_stopping, - early_stopping_delay=early_stopping_delay, - early_stopping_patience=early_stopping_patience, - enable_onnx_normalization=enable_onnx_normalization, - evaluation_frequency=evaluation_frequency, - gradient_accumulation_step=gradient_accumulation_step, - layers_to_freeze=layers_to_freeze, - learning_rate=learning_rate, - learning_rate_scheduler=learning_rate_scheduler, - model_name=model_name, - momentum=momentum, - nesterov=nesterov, - number_of_epochs=number_of_epochs, - number_of_workers=number_of_workers, - optimizer=optimizer, - random_seed=random_seed, - step_lr_gamma=step_lr_gamma, - step_lr_step_size=step_lr_step_size, - training_batch_size=training_batch_size, - validation_batch_size=validation_batch_size, - warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, - warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, - weight_decay=weight_decay, - **kwargs - ) - self.training_crop_size = training_crop_size - self.validation_crop_size = validation_crop_size - self.validation_resize_size = validation_resize_size - self.weighted_loss = weighted_loss + super().__init__(**kwargs) + self.next_link = next_link + self.value = value -class ImageModelSettingsObjectDetection(ImageModelSettings): # pylint: disable=too-many-instance-attributes - """Settings used for training the model. - For more information on the available settings please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. +class EndpointScheduleAction(ScheduleActionBase): + """EndpointScheduleAction. - :ivar advanced_settings: Settings for advanced scenarios. - :vartype advanced_settings: str - :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :vartype ams_gradient: bool - :ivar augmentations: Settings for using Augmentations. - :vartype augmentations: str - :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta1: float - :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range - [0, 1]. - :vartype beta2: float - :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. - :vartype checkpoint_frequency: int - :ivar checkpoint_model: The pretrained checkpoint model for incremental training. - :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :vartype checkpoint_run_id: str - :ivar distributed: Whether to use distributed training. - :vartype distributed: bool - :ivar early_stopping: Enable early stopping logic during training. - :vartype early_stopping: bool - :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before - primary metric improvement - is tracked for early stopping. Must be a positive integer. - :vartype early_stopping_delay: int - :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :vartype early_stopping_patience: int - :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. - :vartype enable_onnx_normalization: bool - :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must - be a positive integer. - :vartype evaluation_frequency: int - :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :vartype gradient_accumulation_step: int - :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype layers_to_freeze: int - :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :vartype learning_rate: float - :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :vartype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :ivar model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :vartype model_name: str - :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. - :vartype momentum: float - :ivar nesterov: Enable nesterov when optimizer is 'sgd'. - :vartype nesterov: bool - :ivar number_of_epochs: Number of training epochs. Must be a positive integer. - :vartype number_of_epochs: int - :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. - :vartype number_of_workers: int - :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :ivar random_seed: Random seed to be used when using deterministic training. - :vartype random_seed: int - :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in - the range [0, 1]. - :vartype step_lr_gamma: float - :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a - positive integer. - :vartype step_lr_step_size: int - :ivar training_batch_size: Training batch size. Must be a positive integer. - :vartype training_batch_size: int - :ivar validation_batch_size: Validation batch size. Must be a positive integer. - :vartype validation_batch_size: int - :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :vartype warmup_cosine_lr_cycles: float - :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :vartype warmup_cosine_lr_warmup_epochs: int - :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be - a float in the range[0, 1]. - :vartype weight_decay: float - :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must - be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype box_detections_per_image: int - :ivar box_score_threshold: During inference, only return proposals with a classification score - greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :vartype box_score_threshold: float - :ivar image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype image_size: int - :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype max_size: int - :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype min_size: int - :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. Known values are: "None", - "Small", "Medium", "Large", and "ExtraLarge". - :vartype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize - :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :vartype multi_scale: bool - :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be a - float in the range [0, 1]. - :vartype nms_iou_threshold: float - :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not - be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_grid_size: str - :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float - in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_overlap_ratio: float - :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - :vartype tile_predictions_nms_threshold: float - :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be - float in the range [0, 1]. - :vartype validation_iou_threshold: float - :ivar validation_metric_type: Metric computation method to use for validation metrics. Known - values are: "None", "Coco", "Voc", and "CocoVoc". - :vartype validation_metric_type: str or - ~azure.mgmt.machinelearningservices.models.ValidationMetricType + All required parameters must be populated in order to send to server. + + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar endpoint_invocation_definition: [Required] Defines Schedule action definition details. + + + .. raw:: html + + . Required. + :vartype endpoint_invocation_definition: JSON """ + _validation = { + "action_type": {"required": True}, + "endpoint_invocation_definition": {"required": True}, + } + _attribute_map = { - "advanced_settings": {"key": "advancedSettings", "type": "str"}, - "ams_gradient": {"key": "amsGradient", "type": "bool"}, - "augmentations": {"key": "augmentations", "type": "str"}, - "beta1": {"key": "beta1", "type": "float"}, - "beta2": {"key": "beta2", "type": "float"}, - "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, - "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, - "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, - "distributed": {"key": "distributed", "type": "bool"}, - "early_stopping": {"key": "earlyStopping", "type": "bool"}, - "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, - "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, - "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, - "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, - "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, - "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, - "learning_rate": {"key": "learningRate", "type": "float"}, - "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, - "model_name": {"key": "modelName", "type": "str"}, - "momentum": {"key": "momentum", "type": "float"}, - "nesterov": {"key": "nesterov", "type": "bool"}, - "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, - "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, - "optimizer": {"key": "optimizer", "type": "str"}, - "random_seed": {"key": "randomSeed", "type": "int"}, - "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, - "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, - "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, - "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, - "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, - "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, - "weight_decay": {"key": "weightDecay", "type": "float"}, - "box_detections_per_image": {"key": "boxDetectionsPerImage", "type": "int"}, - "box_score_threshold": {"key": "boxScoreThreshold", "type": "float"}, - "image_size": {"key": "imageSize", "type": "int"}, - "max_size": {"key": "maxSize", "type": "int"}, - "min_size": {"key": "minSize", "type": "int"}, - "model_size": {"key": "modelSize", "type": "str"}, - "multi_scale": {"key": "multiScale", "type": "bool"}, - "nms_iou_threshold": {"key": "nmsIouThreshold", "type": "float"}, - "tile_grid_size": {"key": "tileGridSize", "type": "str"}, - "tile_overlap_ratio": {"key": "tileOverlapRatio", "type": "float"}, - "tile_predictions_nms_threshold": {"key": "tilePredictionsNmsThreshold", "type": "float"}, - "validation_iou_threshold": {"key": "validationIouThreshold", "type": "float"}, - "validation_metric_type": {"key": "validationMetricType", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, + "endpoint_invocation_definition": {"key": "endpointInvocationDefinition", "type": "object"}, } - def __init__( # pylint: disable=too-many-locals + def __init__(self, *, endpoint_invocation_definition: JSON, **kwargs: Any) -> None: + """ + :keyword endpoint_invocation_definition: [Required] Defines Schedule action definition details. + + + .. raw:: html + + . Required. + :paramtype endpoint_invocation_definition: JSON + """ + super().__init__(**kwargs) + self.action_type: str = "InvokeBatchEndpoint" + self.endpoint_invocation_definition = endpoint_invocation_definition + + +class EnvironmentContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.EnvironmentContainerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "EnvironmentContainerProperties"}, + } + + def __init__(self, *, properties: "_models.EnvironmentContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.EnvironmentContainerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EnvironmentContainerProperties(AssetContainer): + """Container for environment specification versions. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :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 = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( self, *, - advanced_settings: Optional[str] = None, - ams_gradient: Optional[bool] = None, - augmentations: Optional[str] = None, - beta1: Optional[float] = None, - beta2: Optional[float] = None, - checkpoint_frequency: Optional[int] = None, - checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, - checkpoint_run_id: Optional[str] = None, - distributed: Optional[bool] = None, - early_stopping: Optional[bool] = None, - early_stopping_delay: Optional[int] = None, - early_stopping_patience: Optional[int] = None, - enable_onnx_normalization: Optional[bool] = None, - evaluation_frequency: Optional[int] = None, - gradient_accumulation_step: Optional[int] = None, - layers_to_freeze: Optional[int] = None, - learning_rate: Optional[float] = None, - learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, - model_name: Optional[str] = None, - momentum: Optional[float] = None, - nesterov: Optional[bool] = None, - number_of_epochs: Optional[int] = None, - number_of_workers: Optional[int] = None, - optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, - random_seed: Optional[int] = None, - step_lr_gamma: Optional[float] = None, - step_lr_step_size: Optional[int] = None, - training_batch_size: Optional[int] = None, - validation_batch_size: Optional[int] = None, - warmup_cosine_lr_cycles: Optional[float] = None, - warmup_cosine_lr_warmup_epochs: Optional[int] = None, - weight_decay: Optional[float] = None, - box_detections_per_image: Optional[int] = None, - box_score_threshold: Optional[float] = None, - image_size: Optional[int] = None, - max_size: Optional[int] = None, - min_size: Optional[int] = None, - model_size: Optional[Union[str, "_models.ModelSize"]] = None, - multi_scale: Optional[bool] = None, - nms_iou_threshold: Optional[float] = None, - tile_grid_size: Optional[str] = None, - tile_overlap_ratio: Optional[float] = None, - tile_predictions_nms_threshold: Optional[float] = None, - validation_iou_threshold: Optional[float] = None, - validation_metric_type: Optional[Union[str, "_models.ValidationMetricType"]] = None, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: bool = False, **kwargs: Any ) -> None: """ - :keyword advanced_settings: Settings for advanced scenarios. - :paramtype advanced_settings: str - :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. - :paramtype ams_gradient: bool - :keyword augmentations: Settings for using Augmentations. - :paramtype augmentations: str - :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta1: float - :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the - range [0, 1]. - :paramtype beta2: float - :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive - integer. - :paramtype checkpoint_frequency: int - :keyword checkpoint_model: The pretrained checkpoint model for incremental training. - :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput - :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for - incremental training. - :paramtype checkpoint_run_id: str - :keyword distributed: Whether to use distributed training. - :paramtype distributed: bool - :keyword early_stopping: Enable early stopping logic during training. - :paramtype early_stopping: bool - :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait - before primary metric improvement - is tracked for early stopping. Must be a positive integer. - :paramtype early_stopping_delay: int - :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no - primary metric improvement before - the run is stopped. Must be a positive integer. - :paramtype early_stopping_patience: int - :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. - :paramtype enable_onnx_normalization: bool - :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. - Must be a positive integer. - :paramtype evaluation_frequency: int - :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of - "GradAccumulationStep" steps without - updating the model weights while accumulating the gradients of those steps, and then using - the accumulated gradients to compute the weight updates. Must be a positive integer. - :paramtype gradient_accumulation_step: int - :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive - integer. - For instance, passing 2 as value for 'seresnext' means - freezing layer0 and layer1. For a full list of models supported and details on layer freeze, - please - see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype layers_to_freeze: int - :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. - :paramtype learning_rate: float - :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or - 'step'. Known values are: "None", "WarmupCosine", and "Step". - :paramtype learning_rate_scheduler: str or - ~azure.mgmt.machinelearningservices.models.LearningRateScheduler - :keyword model_name: Name of the model to use for training. - For more information on the available models please visit the official documentation: - https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. - :paramtype model_name: str - :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, - 1]. - :paramtype momentum: float - :keyword nesterov: Enable nesterov when optimizer is 'sgd'. - :paramtype nesterov: bool - :keyword number_of_epochs: Number of training epochs. Must be a positive integer. - :paramtype number_of_epochs: int - :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. - :paramtype number_of_workers: int - :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". - :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer - :keyword random_seed: Random seed to be used when using deterministic training. - :paramtype random_seed: int - :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float - in the range [0, 1]. - :paramtype step_lr_gamma: float - :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be - a positive integer. - :paramtype step_lr_step_size: int - :keyword training_batch_size: Training batch size. Must be a positive integer. - :paramtype training_batch_size: int - :keyword validation_batch_size: Validation batch size. Must be a positive integer. - :paramtype validation_batch_size: int - :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is - 'warmup_cosine'. Must be a float in the range [0, 1]. - :paramtype warmup_cosine_lr_cycles: float - :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is - 'warmup_cosine'. Must be a positive integer. - :paramtype warmup_cosine_lr_warmup_epochs: int - :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must - be a float in the range[0, 1]. - :paramtype weight_decay: float - :keyword box_detections_per_image: Maximum number of detections per image, for all classes. - Must be a positive integer. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype box_detections_per_image: int - :keyword box_score_threshold: During inference, only return proposals with a classification - score greater than - BoxScoreThreshold. Must be a float in the range[0, 1]. - :paramtype box_score_threshold: float - :keyword image_size: Image size for train and validation. Must be a positive integer. - Note: The training run may get into CUDA OOM if the size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype image_size: int - :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype max_size: int - :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. - Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype min_size: int - :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. - Note: training run may get into CUDA OOM if the model size is too big. - Note: This settings is only supported for the 'yolov5' algorithm. Known values are: "None", - "Small", "Medium", "Large", and "ExtraLarge". - :paramtype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize - :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. - Note: training run may get into CUDA OOM if no sufficient GPU memory. - Note: This settings is only supported for the 'yolov5' algorithm. - :paramtype multi_scale: bool - :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be - a float in the range [0, 1]. - :paramtype nms_iou_threshold: float - :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must - not be - None to enable small object detection logic. A string containing two integers in mxn format. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_grid_size: str - :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be - float in the range [0, 1). - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_overlap_ratio: float - :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging - predictions from tiles and image. - Used in validation/ inference. Must be float in the range [0, 1]. - Note: This settings is not supported for the 'yolov5' algorithm. - :paramtype tile_predictions_nms_threshold: float - :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must - be float in the range [0, 1]. - :paramtype validation_iou_threshold: float - :keyword validation_metric_type: Metric computation method to use for validation metrics. Known - values are: "None", "Coco", "Voc", and "CocoVoc". - :paramtype validation_metric_type: str or - ~azure.mgmt.machinelearningservices.models.ValidationMetricType + :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 is_archived: Is the asset archived?. + :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): # pylint: disable=name-too-long + """A paginated list of EnvironmentContainer entities. + + :ivar next_link: The link to the next page of EnvironmentContainer objects. If null, there are + no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type EnvironmentContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EnvironmentContainer]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.EnvironmentContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of EnvironmentContainer objects. If null, there + are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type EnvironmentContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentContainer] + """ + super().__init__(**kwargs) + self.next_link = next_link + 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: Any + ) -> None: + """ + :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(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.EnvironmentVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "EnvironmentVersionProperties"}, + } + + def __init__(self, *, properties: "_models.EnvironmentVersionProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.EnvironmentVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class EnvironmentVersionProperties(AssetBase): # pylint: disable=too-many-instance-attributes + """Environment 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Known + values are: "Disabled" and "OnBaseImageUpdate". + :vartype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :ivar build: Configuration settings for Docker build context. + :vartype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :ivar conda_file: Standard configuration file used by Conda that lets you install any kind of + package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :vartype conda_file: str + :ivar environment_type: Environment type is either user managed or curated by the Azure ML + service + + + .. raw:: html + + . Known values are: "Curated" and "UserCreated". + :vartype environment_type: str or ~azure.mgmt.machinelearningservices.models.EnvironmentType + :ivar image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :vartype image: str + :ivar inference_config: Defines configuration specific to inference. + :vartype inference_config: + ~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 + :ivar stage: Stage in the environment lifecycle assigned to this environment. + :vartype stage: str + """ + + _validation = { + "environment_type": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "auto_rebuild": {"key": "autoRebuild", "type": "str"}, + "build": {"key": "build", "type": "BuildContext"}, + "conda_file": {"key": "condaFile", "type": "str"}, + "environment_type": {"key": "environmentType", "type": "str"}, + "image": {"key": "image", "type": "str"}, + "inference_config": {"key": "inferenceConfig", "type": "InferenceContainerProperties"}, + "os_type": {"key": "osType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + auto_rebuild: Optional[Union[str, "_models.AutoRebuildSetting"]] = None, + build: Optional["_models.BuildContext"] = None, + conda_file: Optional[str] = None, + image: Optional[str] = None, + inference_config: Optional["_models.InferenceContainerProperties"] = None, + os_type: Optional[Union[str, "_models.OperatingSystemType"]] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword auto_rebuild: Defines if image needs to be rebuilt based on base image changes. Known + values are: "Disabled" and "OnBaseImageUpdate". + :paramtype auto_rebuild: str or ~azure.mgmt.machinelearningservices.models.AutoRebuildSetting + :keyword build: Configuration settings for Docker build context. + :paramtype build: ~azure.mgmt.machinelearningservices.models.BuildContext + :keyword conda_file: Standard configuration file used by Conda that lets you install any kind + of package, including Python, R, and C/C++ packages. + + + .. raw:: html + + . + :paramtype conda_file: str + :keyword image: Name of the image that will be used for the environment. + + + .. raw:: html + + . + :paramtype image: str + :keyword inference_config: Defines configuration specific to inference. + :paramtype inference_config: + ~azure.mgmt.machinelearningservices.models.InferenceContainerProperties + :keyword os_type: The OS type of the environment. Known values are: "Linux" and "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.OperatingSystemType + :keyword stage: Stage in the environment lifecycle assigned to this environment. + :paramtype stage: str + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.auto_rebuild = auto_rebuild + self.build = build + self.conda_file = conda_file + self.environment_type = None + self.image = image + self.inference_config = inference_config + self.os_type = os_type + self.provisioning_state = None + self.stage = stage + + +class EnvironmentVersionResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of EnvironmentVersion entities. + + :ivar next_link: The link to the next page of EnvironmentVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type EnvironmentVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[EnvironmentVersion]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.EnvironmentVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of EnvironmentVersion objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type EnvironmentVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.EnvironmentVersion] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type = None + self.info = None + + +class ErrorDetail(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.machinelearningservices.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.machinelearningservices.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetail]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.machinelearningservices.models.ErrorDetail + """ + super().__init__(**kwargs) + self.error = error + + +class EstimatedVMPrice(_serialization.Model): + """The estimated price info for using a VM of a particular OS type, tier, etc. + + All required parameters must be populated in order to send to server. + + :ivar retail_price: The price charged for using the VM. Required. + :vartype retail_price: float + :ivar os_type: Operating system type used by the VM. Required. Known values are: "Linux" and + "Windows". + :vartype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :ivar vm_tier: The type of the VM. Required. Known values are: "Standard", "LowPriority", and + "Spot". + :vartype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier + """ + + _validation = { + "retail_price": {"required": True}, + "os_type": {"required": True}, + "vm_tier": {"required": True}, + } + + _attribute_map = { + "retail_price": {"key": "retailPrice", "type": "float"}, + "os_type": {"key": "osType", "type": "str"}, + "vm_tier": {"key": "vmTier", "type": "str"}, + } + + def __init__( + self, + *, + retail_price: float, + os_type: Union[str, "_models.VMPriceOSType"], + vm_tier: Union[str, "_models.VMTier"], + **kwargs: Any + ) -> None: + """ + :keyword retail_price: The price charged for using the VM. Required. + :paramtype retail_price: float + :keyword os_type: Operating system type used by the VM. Required. Known values are: "Linux" and + "Windows". + :paramtype os_type: str or ~azure.mgmt.machinelearningservices.models.VMPriceOSType + :keyword vm_tier: The type of the VM. Required. Known values are: "Standard", "LowPriority", + and "Spot". + :paramtype vm_tier: str or ~azure.mgmt.machinelearningservices.models.VMTier + """ + super().__init__(**kwargs) + self.retail_price = retail_price + self.os_type = os_type + self.vm_tier = vm_tier + + +class EstimatedVMPrices(_serialization.Model): + """The estimated price info for using a VM. + + All required parameters must be populated in order to send to server. + + :ivar billing_currency: Three lettered code specifying the currency of the VM price. Example: + USD. Required. "USD" + :vartype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :ivar unit_of_measure: The unit of time measurement for the specified VM price. Example: + OneHour. Required. "OneHour" + :vartype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :ivar values: The list of estimated prices for using a VM of a particular OS type, tier, etc. + Required. + :vartype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + """ + + _validation = { + "billing_currency": {"required": True}, + "unit_of_measure": {"required": True}, + "values": {"required": True}, + } + + _attribute_map = { + "billing_currency": {"key": "billingCurrency", "type": "str"}, + "unit_of_measure": {"key": "unitOfMeasure", "type": "str"}, + "values": {"key": "values", "type": "[EstimatedVMPrice]"}, + } + + def __init__( + self, + *, + billing_currency: Union[str, "_models.BillingCurrency"], + unit_of_measure: Union[str, "_models.UnitOfMeasure"], + values: List["_models.EstimatedVMPrice"], + **kwargs: Any + ) -> None: + """ + :keyword billing_currency: Three lettered code specifying the currency of the VM price. + Example: USD. Required. "USD" + :paramtype billing_currency: str or ~azure.mgmt.machinelearningservices.models.BillingCurrency + :keyword unit_of_measure: The unit of time measurement for the specified VM price. Example: + OneHour. Required. "OneHour" + :paramtype unit_of_measure: str or ~azure.mgmt.machinelearningservices.models.UnitOfMeasure + :keyword values: The list of estimated prices for using a VM of a particular OS type, tier, + etc. Required. + :paramtype values: list[~azure.mgmt.machinelearningservices.models.EstimatedVMPrice] + """ + super().__init__(**kwargs) + self.billing_currency = billing_currency + self.unit_of_measure = unit_of_measure + self.values = values + + +class ExternalFQDNResponse(_serialization.Model): + """ExternalFQDNResponse. + + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] + """ + + _attribute_map = { + "value": {"key": "value", "type": "[FQDNEndpointsPropertyBag]"}, + } + + def __init__(self, *, value: Optional[List["_models.FQDNEndpointsPropertyBag"]] = None, **kwargs: Any) -> None: + """ + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointsPropertyBag] + """ + super().__init__(**kwargs) + self.value = value + + +class Feature(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.FeatureProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "FeatureProperties"}, + } + + def __init__(self, *, properties: "_models.FeatureProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeatureProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FeatureAttributionDriftMonitoringSignal(MonitoringSignalBase): + """FeatureAttributionDriftMonitoringSignal. + + All required parameters must be populated in order to send to server. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar feature_importance_settings: [Required] The settings for computing feature importance. + Required. + :vartype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :ivar metric_threshold: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :ivar production_data: [Required] The data which drift will be calculated for. Required. + :vartype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :ivar reference_data: [Required] The data to calculate drift against. Required. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + + _validation = { + "signal_type": {"required": True}, + "feature_importance_settings": {"required": True}, + "metric_threshold": {"required": True}, + "production_data": {"required": True}, + "reference_data": {"required": True}, + } + + _attribute_map = { + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "feature_data_type_override": {"key": "featureDataTypeOverride", "type": "{str}"}, + "feature_importance_settings": {"key": "featureImportanceSettings", "type": "FeatureImportanceSettings"}, + "metric_threshold": {"key": "metricThreshold", "type": "FeatureAttributionMetricThreshold"}, + "production_data": {"key": "productionData", "type": "[MonitoringInputDataBase]"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, + } + + def __init__( + self, + *, + feature_importance_settings: "_models.FeatureImportanceSettings", + metric_threshold: "_models.FeatureAttributionMetricThreshold", + production_data: List["_models.MonitoringInputDataBase"], + reference_data: "_models.MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "_models.MonitoringFeatureDataType"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword feature_importance_settings: [Required] The settings for computing feature importance. + Required. + :paramtype feature_importance_settings: + ~azure.mgmt.machinelearningservices.models.FeatureImportanceSettings + :keyword metric_threshold: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_threshold: + ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetricThreshold + :keyword production_data: [Required] The data which drift will be calculated for. Required. + :paramtype production_data: + list[~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase] + :keyword reference_data: [Required] The data to calculate drift against. Required. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "FeatureAttributionDrift" + self.feature_data_type_override = feature_data_type_override + self.feature_importance_settings = feature_importance_settings + self.metric_threshold = metric_threshold + self.production_data = production_data + self.reference_data = reference_data + + +class FeatureAttributionMetricThreshold(_serialization.Model): + """FeatureAttributionMetricThreshold. + + All required parameters must be populated in order to send to server. + + :ivar metric: [Required] The feature attribution metric to calculate. Required. + "NormalizedDiscountedCumulativeGain" + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + """ + + _validation = { + "metric": {"required": True}, + } + + _attribute_map = { + "metric": {"key": "metric", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + } + + def __init__( + self, + *, + metric: Union[str, "_models.FeatureAttributionMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any + ) -> None: + """ + :keyword metric: [Required] The feature attribution metric to calculate. Required. + "NormalizedDiscountedCumulativeGain" + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.FeatureAttributionMetric + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + """ + super().__init__(**kwargs) + self.metric = metric + self.threshold = threshold + + +class FeatureImportanceSettings(_serialization.Model): + """FeatureImportanceSettings. + + :ivar mode: The mode of operation for computing feature importance. Known values are: + "Disabled" and "Enabled". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :ivar target_column: The name of the target column within the input data asset. + :vartype target_column: str + """ + + _attribute_map = { + "mode": {"key": "mode", "type": "str"}, + "target_column": {"key": "targetColumn", "type": "str"}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "_models.FeatureImportanceMode"]] = None, + target_column: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword mode: The mode of operation for computing feature importance. Known values are: + "Disabled" and "Enabled". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.FeatureImportanceMode + :keyword target_column: The name of the target column within the input data asset. + :paramtype target_column: str + """ + super().__init__(**kwargs) + self.mode = mode + self.target_column = target_column + + +class FeatureProperties(ResourceBase): + """DTO object representing feature. + + :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 data_type: Specifies type. Known values are: "String", "Integer", "Long", "Float", + "Double", "Binary", "Datetime", and "Boolean". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :ivar feature_name: Specifies name. + :vartype feature_name: str + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "data_type": {"key": "dataType", "type": "str"}, + "feature_name": {"key": "featureName", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + data_type: Optional[Union[str, "_models.FeatureDataType"]] = None, + feature_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 data_type: Specifies type. Known values are: "String", "Integer", "Long", "Float", + "Double", "Binary", "Datetime", and "Boolean". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + :keyword feature_name: Specifies name. + :paramtype feature_name: str + """ + super().__init__(description=description, properties=properties, tags=tags, **kwargs) + self.data_type = data_type + self.feature_name = feature_name + + +class FeatureResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Feature entities. + + :ivar next_link: The link to the next page of Feature objects. If null, there are no additional + pages. + :vartype next_link: str + :ivar value: An array of objects of type Feature. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Feature] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Feature]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Feature"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of Feature objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type Feature. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Feature] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeaturesetContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.FeaturesetContainerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "FeaturesetContainerProperties"}, + } + + def __init__(self, *, properties: "_models.FeaturesetContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetContainerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FeaturesetContainerProperties(AssetContainer): + """DTO object representing feature set. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featureset 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 = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: bool = False, + **kwargs: Any + ) -> None: + """ + :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 is_archived: Is the asset archived?. + :paramtype is_archived: bool + """ + super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None + + +class FeaturesetContainerResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of FeaturesetContainer entities. + + :ivar next_link: The link to the next page of FeaturesetContainer objects. If null, there are + no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturesetContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[FeaturesetContainer]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.FeaturesetContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of FeaturesetContainer objects. If null, there + are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturesetContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeaturesetSpecification(_serialization.Model): + """DTO object representing specification. + + :ivar path: Specifies the spec path. + :vartype path: str + """ + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + } + + def __init__(self, *, path: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword path: Specifies the spec path. + :paramtype path: str + """ + super().__init__(**kwargs) + self.path = path + + +class FeaturesetVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.FeaturesetVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "FeaturesetVersionProperties"}, + } + + def __init__(self, *, properties: "_models.FeaturesetVersionProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FeaturesetVersionBackfillRequest(_serialization.Model): + """Request payload for creating a backfill request for a given feature set version. + + :ivar data_availability_status: Specified the data availability status that you want to + backfill. + :vartype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :ivar description: Specifies description. + :vartype description: str + :ivar display_name: Specifies description. + :vartype display_name: str + :ivar feature_window: Specifies the backfill feature window to be materialized. + :vartype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :ivar job_id: Specify the jobId to retry the failed materialization. + :vartype job_id: str + :ivar properties: Specifies the properties. + :vartype properties: dict[str, str] + :ivar resource: Specifies the compute resource settings. + :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :ivar spark_configuration: Specifies the spark compute settings. + :vartype spark_configuration: dict[str, str] + :ivar tags: Specifies the tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "data_availability_status": {"key": "dataAvailabilityStatus", "type": "[str]"}, + "description": {"key": "description", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "feature_window": {"key": "featureWindow", "type": "FeatureWindow"}, + "job_id": {"key": "jobId", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "resource": {"key": "resource", "type": "MaterializationComputeResource"}, + "spark_configuration": {"key": "sparkConfiguration", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + data_availability_status: Optional[List[Union[str, "_models.DataAvailabilityStatus"]]] = None, + description: Optional[str] = None, + display_name: Optional[str] = None, + feature_window: Optional["_models.FeatureWindow"] = None, + job_id: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + resource: Optional["_models.MaterializationComputeResource"] = None, + spark_configuration: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword data_availability_status: Specified the data availability status that you want to + backfill. + :paramtype data_availability_status: list[str or + ~azure.mgmt.machinelearningservices.models.DataAvailabilityStatus] + :keyword description: Specifies description. + :paramtype description: str + :keyword display_name: Specifies description. + :paramtype display_name: str + :keyword feature_window: Specifies the backfill feature window to be materialized. + :paramtype feature_window: ~azure.mgmt.machinelearningservices.models.FeatureWindow + :keyword job_id: Specify the jobId to retry the failed materialization. + :paramtype job_id: str + :keyword properties: Specifies the properties. + :paramtype properties: dict[str, str] + :keyword resource: Specifies the compute resource settings. + :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :keyword spark_configuration: Specifies the spark compute settings. + :paramtype spark_configuration: dict[str, str] + :keyword tags: Specifies the tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.data_availability_status = data_availability_status + self.description = description + self.display_name = display_name + self.feature_window = feature_window + self.job_id = job_id + self.properties = properties + self.resource = resource + self.spark_configuration = spark_configuration + self.tags = tags + + +class FeaturesetVersionBackfillResponse(_serialization.Model): + """Response payload for creating a backfill request for a given feature set version. + + :ivar job_ids: List of jobs submitted as part of the backfill request. + :vartype job_ids: list[str] + """ + + _attribute_map = { + "job_ids": {"key": "jobIds", "type": "[str]"}, + } + + def __init__(self, *, job_ids: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword job_ids: List of jobs submitted as part of the backfill request. + :paramtype job_ids: list[str] + """ + super().__init__(**kwargs) + self.job_ids = job_ids + + +class FeaturesetVersionProperties(AssetBase): + """DTO object representing feature set version. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar entities: Specifies list of entities. + :vartype entities: list[str] + :ivar materialization_settings: Specifies the materialization settings. + :vartype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :ivar provisioning_state: Provisioning state for the featureset version container. Known values + are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar specification: Specifies the feature spec details. + :vartype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :ivar stage: Specifies the asset stage. + :vartype stage: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "entities": {"key": "entities", "type": "[str]"}, + "materialization_settings": {"key": "materializationSettings", "type": "MaterializationSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "specification": {"key": "specification", "type": "FeaturesetSpecification"}, + "stage": {"key": "stage", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + entities: Optional[List[str]] = None, + materialization_settings: Optional["_models.MaterializationSettings"] = None, + specification: Optional["_models.FeaturesetSpecification"] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword entities: Specifies list of entities. + :paramtype entities: list[str] + :keyword materialization_settings: Specifies the materialization settings. + :paramtype materialization_settings: + ~azure.mgmt.machinelearningservices.models.MaterializationSettings + :keyword specification: Specifies the feature spec details. + :paramtype specification: ~azure.mgmt.machinelearningservices.models.FeaturesetSpecification + :keyword stage: Specifies the asset stage. + :paramtype stage: str + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.entities = entities + self.materialization_settings = materialization_settings + self.provisioning_state = None + self.specification = specification + self.stage = stage + + +class FeaturesetVersionResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of FeaturesetVersion entities. + + :ivar next_link: The link to the next page of FeaturesetVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturesetVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[FeaturesetVersion]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.FeaturesetVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of FeaturesetVersion objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturesetVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeaturestoreEntityContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.FeaturestoreEntityContainerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "FeaturestoreEntityContainerProperties"}, + } + + def __init__(self, *, properties: "_models.FeaturestoreEntityContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FeaturestoreEntityContainerProperties(AssetContainer): + """DTO object representing feature entity. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :vartype latest_version: str + :ivar next_version: The next auto incremental version. + :vartype next_version: str + :ivar provisioning_state: Provisioning state for the featurestore entity 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 = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: bool = False, + **kwargs: Any + ) -> None: + """ + :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 is_archived: Is the asset archived?. + :paramtype is_archived: bool + """ + super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) + self.provisioning_state = None + + +class FeaturestoreEntityContainerResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of FeaturestoreEntityContainer entities. + + :ivar next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[FeaturestoreEntityContainer]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.FeaturestoreEntityContainer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of FeaturestoreEntityContainer objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeaturestoreEntityVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.FeaturestoreEntityVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "FeaturestoreEntityVersionProperties"}, + } + + def __init__(self, *, properties: "_models.FeaturestoreEntityVersionProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class FeaturestoreEntityVersionProperties(AssetBase): + """DTO object representing feature entity version. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar index_columns: Specifies index columns. + :vartype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :ivar provisioning_state: Provisioning state for the featurestore entity version. Known values + are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.AssetProvisioningState + :ivar stage: Specifies the asset stage. + :vartype stage: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "index_columns": {"key": "indexColumns", "type": "[IndexColumn]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + index_columns: Optional[List["_models.IndexColumn"]] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword index_columns: Specifies index columns. + :paramtype index_columns: list[~azure.mgmt.machinelearningservices.models.IndexColumn] + :keyword stage: Specifies the asset stage. + :paramtype stage: str + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + **kwargs + ) + self.index_columns = index_columns + self.provisioning_state = None + self.stage = stage + + +class FeaturestoreEntityVersionResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of FeaturestoreEntityVersion entities. + + :ivar next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type FeaturestoreEntityVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[FeaturestoreEntityVersion]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.FeaturestoreEntityVersion"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of FeaturestoreEntityVersion objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type FeaturestoreEntityVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class FeatureStoreSettings(_serialization.Model): + """FeatureStoreSettings. + + :ivar compute_runtime: + :vartype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :ivar offline_store_connection_name: + :vartype offline_store_connection_name: str + :ivar online_store_connection_name: + :vartype online_store_connection_name: str + """ + + _attribute_map = { + "compute_runtime": {"key": "computeRuntime", "type": "ComputeRuntimeDto"}, + "offline_store_connection_name": {"key": "offlineStoreConnectionName", "type": "str"}, + "online_store_connection_name": {"key": "onlineStoreConnectionName", "type": "str"}, + } + + def __init__( + self, + *, + compute_runtime: Optional["_models.ComputeRuntimeDto"] = None, + offline_store_connection_name: Optional[str] = None, + online_store_connection_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword compute_runtime: + :paramtype compute_runtime: ~azure.mgmt.machinelearningservices.models.ComputeRuntimeDto + :keyword offline_store_connection_name: + :paramtype offline_store_connection_name: str + :keyword online_store_connection_name: + :paramtype online_store_connection_name: str + """ + super().__init__(**kwargs) + self.compute_runtime = compute_runtime + self.offline_store_connection_name = offline_store_connection_name + self.online_store_connection_name = online_store_connection_name + + +class FeatureSubset(MonitoringFeatureFilterBase): + """FeatureSubset. + + All required parameters must be populated in order to send to server. + + :ivar filter_type: [Required] Specifies the feature filter to leverage when selecting features + to calculate metrics over. Required. Known values are: "AllFeatures", "TopNByAttribution", and + "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType + :ivar features: [Required] The list of features to include. Required. + :vartype features: list[str] + """ + + _validation = { + "filter_type": {"required": True}, + "features": {"required": True}, + } + + _attribute_map = { + "filter_type": {"key": "filterType", "type": "str"}, + "features": {"key": "features", "type": "[str]"}, + } + + def __init__(self, *, features: List[str], **kwargs: Any) -> None: + """ + :keyword features: [Required] The list of features to include. Required. + :paramtype features: list[str] + """ + super().__init__(**kwargs) + self.filter_type: str = "FeatureSubset" + self.features = features + + +class FeatureWindow(_serialization.Model): + """Specifies the feature window. + + :ivar feature_window_end: Specifies the feature window end time. + :vartype feature_window_end: ~datetime.datetime + :ivar feature_window_start: Specifies the feature window start time. + :vartype feature_window_start: ~datetime.datetime + """ + + _attribute_map = { + "feature_window_end": {"key": "featureWindowEnd", "type": "iso-8601"}, + "feature_window_start": {"key": "featureWindowStart", "type": "iso-8601"}, + } + + def __init__( + self, + *, + feature_window_end: Optional[datetime.datetime] = None, + feature_window_start: Optional[datetime.datetime] = None, + **kwargs: Any + ) -> None: + """ + :keyword feature_window_end: Specifies the feature window end time. + :paramtype feature_window_end: ~datetime.datetime + :keyword feature_window_start: Specifies the feature window start time. + :paramtype feature_window_start: ~datetime.datetime + """ + super().__init__(**kwargs) + self.feature_window_end = feature_window_end + self.feature_window_start = feature_window_start + + +class FeaturizationSettings(_serialization.Model): + """Featurization Configuration. + + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str + """ + + _attribute_map = { + "dataset_language": {"key": "datasetLanguage", "type": "str"}, + } + + def __init__(self, *, dataset_language: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword dataset_language: Dataset language, useful for the text data. + :paramtype dataset_language: str + """ + super().__init__(**kwargs) + self.dataset_language = dataset_language + + +class FineTuningJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """FineTuning 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 server. + + :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", "Sweep", "Pipeline", "Spark", and "FineTuning". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.JobStatus + :ivar fine_tuning_details: [Required]. Required. + :vartype fine_tuning_details: ~azure.mgmt.machinelearningservices.models.FineTuningVertical + :ivar outputs: [Required]. Required. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar queue_settings: Queue settings for the job. + :vartype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :ivar resources: Instance types and other resources for the job. + :vartype resources: ~azure.mgmt.machinelearningservices.models.JobResources + """ + + _validation = { + "job_type": {"required": True}, + "status": {"readonly": True}, + "fine_tuning_details": {"required": True}, + "outputs": {"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"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "fine_tuning_details": {"key": "fineTuningDetails", "type": "FineTuningVertical"}, + "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, + "resources": {"key": "resources", "type": "JobResources"}, + } + + def __init__( + self, + *, + fine_tuning_details: "_models.FineTuningVertical", + outputs: Dict[str, "_models.JobOutput"], + 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + services: Optional[Dict[str, "_models.JobService"]] = None, + queue_settings: Optional["_models.QueueSettings"] = None, + resources: Optional["_models.JobResources"] = None, + **kwargs: Any + ) -> None: + """ + :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 notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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 fine_tuning_details: [Required]. Required. + :paramtype fine_tuning_details: ~azure.mgmt.machinelearningservices.models.FineTuningVertical + :keyword outputs: [Required]. Required. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword queue_settings: Queue settings for the job. + :paramtype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :keyword resources: Instance types and other resources for the job. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.JobResources + """ + 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, + notification_setting=notification_setting, + services=services, + **kwargs + ) + self.job_type: str = "FineTuning" + self.fine_tuning_details = fine_tuning_details + self.outputs = outputs + self.queue_settings = queue_settings + self.resources = resources + + +class MonitoringInputDataBase(_serialization.Model): + """Monitoring input data base definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FixedInputData, RollingInputData, StaticInputData + + All required parameters must be populated in order to send to server. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: [Required] Specifies the type of signal to monitor. Required. Known + values are: "Static", "Rolling", and "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + """ + + _validation = { + "input_data_type": {"required": True}, + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "columns": {"key": "columns", "type": "{str}"}, + "data_context": {"key": "dataContext", "type": "str"}, + "input_data_type": {"key": "inputDataType", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + _subtype_map = { + "input_data_type": {"Fixed": "FixedInputData", "Rolling": "RollingInputData", "Static": "StaticInputData"} + } + + def __init__( + self, + *, + job_input_type: Union[str, "_models.JobInputType"], + uri: str, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(**kwargs) + self.columns = columns + self.data_context = data_context + self.input_data_type: Optional[str] = None + self.job_input_type = job_input_type + self.uri = uri + + +class FixedInputData(MonitoringInputDataBase): + """Fixed input data definition. + + All required parameters must be populated in order to send to server. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: [Required] Specifies the type of signal to monitor. Required. Known + values are: "Static", "Rolling", and "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + """ + + _validation = { + "input_data_type": {"required": True}, + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "columns": {"key": "columns", "type": "{str}"}, + "data_context": {"key": "dataContext", "type": "str"}, + "input_data_type": {"key": "inputDataType", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + job_input_type: Union[str, "_models.JobInputType"], + uri: str, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(columns=columns, data_context=data_context, job_input_type=job_input_type, uri=uri, **kwargs) + self.input_data_type: str = "Fixed" + + +class FlavorData(_serialization.Model): + """FlavorData. + + :ivar data: Model flavor-specific data. + :vartype data: dict[str, str] + """ + + _attribute_map = { + "data": {"key": "data", "type": "{str}"}, + } + + def __init__(self, *, data: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword data: Model flavor-specific data. + :paramtype data: dict[str, str] + """ + super().__init__(**kwargs) + self.data = data + + +class Forecasting(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Forecasting task in AutoML Table vertical. + + All required parameters must be populated in order to send to server. + + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :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 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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype test_data_size: float + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :vartype weight_column_name: str + :ivar forecasting_settings: Forecasting task specific inputs. + :vartype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings + :ivar primary_metric: Primary metric for forecasting task. Known values are: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and + "NormalizedMeanAbsoluteError". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics + :ivar training_settings: Inputs for training phase for an AutoML Job. + :vartype training_settings: + ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, + "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "weight_column_name": {"key": "weightColumnName", "type": "str"}, + "forecasting_settings": {"key": "forecastingSettings", "type": "ForecastingSettings"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + "training_settings": {"key": "trainingSettings", "type": "ForecastingTrainingSettings"}, + } + + def __init__( + self, + *, + training_data: "_models.MLTableJobInput", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + cv_split_column_names: Optional[List[str]] = None, + featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + weight_column_name: Optional[str] = None, + forecasting_settings: Optional["_models.ForecastingSettings"] = None, + primary_metric: Optional[Union[str, "_models.ForecastingPrimaryMetrics"]] = None, + training_settings: Optional["_models.ForecastingTrainingSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword cv_split_column_names: Columns to use for CVSplit data. + :paramtype cv_split_column_names: list[str] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :keyword n_cross_validations: Number of cross validation folds to be applied on training + dataset + when validation dataset is not provided. + :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype test_data_size: float + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :paramtype weight_column_name: str + :keyword forecasting_settings: Forecasting task specific inputs. + :paramtype forecasting_settings: ~azure.mgmt.machinelearningservices.models.ForecastingSettings + :keyword primary_metric: Primary metric for forecasting task. Known values are: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and + "NormalizedMeanAbsoluteError". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ForecastingPrimaryMetrics + :keyword training_settings: Inputs for training phase for an AutoML Job. + :paramtype training_settings: + ~azure.mgmt.machinelearningservices.models.ForecastingTrainingSettings + """ + super().__init__( + cv_split_column_names=cv_split_column_names, + featurization_settings=featurization_settings, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + validation_data_size=validation_data_size, + weight_column_name=weight_column_name, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "Forecasting" + self.training_data = training_data + self.forecasting_settings = forecasting_settings + self.primary_metric = primary_metric + self.training_settings = training_settings + self.cv_split_column_names = cv_split_column_names + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name + + +class ForecastingSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Forecasting specific parameters. + + :ivar country_or_region_for_holidays: Country or region for holidays for forecasting tasks. + These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. + :vartype country_or_region_for_holidays: str + :ivar cv_step_size: Number of periods between the origin time of one CV fold and the next fold. + For + example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be + three days apart. + :vartype cv_step_size: int + :ivar feature_lags: Flag for generating lags for the numeric features with 'auto' or null. + Known values are: "None" and "Auto". + :vartype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags + :ivar forecast_horizon: The desired maximum forecast horizon in units of time-series frequency. + :vartype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon + :ivar frequency: When forecasting, this parameter represents the period with which the forecast + is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset frequency + by default. + :vartype frequency: str + :ivar seasonality: Set time series seasonality as an integer multiple of the series frequency. + If seasonality is set to 'auto', it will be inferred. + :vartype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality + :ivar short_series_handling_config: The parameter defining how if AutoML should handle short + time series. Known values are: "None", "Auto", "Pad", and "Drop". + :vartype short_series_handling_config: str or + ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration + :ivar target_aggregate_function: The function to be used to aggregate the time series target + column to conform to a user specified frequency. + If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the + error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". + Known values are: "None", "Sum", "Max", "Min", and "Mean". + :vartype target_aggregate_function: str or + ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction + :ivar target_lags: The number of past periods to lag from the target column. + :vartype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags + :ivar target_rolling_window_size: The number of past periods used to create a rolling window + average of the target column. + :vartype target_rolling_window_size: + ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize + :ivar time_column_name: The name of the time column. This parameter is required when + forecasting to specify the datetime column in the input data used for building the time series + and inferring its frequency. + :vartype time_column_name: str + :ivar time_series_id_column_names: The names of columns used to group a timeseries. It can be + used to create multiple series. + If grain is not defined, the data set is assumed to be one time-series. This parameter is used + with task type forecasting. + :vartype time_series_id_column_names: list[str] + :ivar use_stl: Configure STL Decomposition of the time-series target column. Known values are: + "None", "Season", and "SeasonTrend". + :vartype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + """ + + _attribute_map = { + "country_or_region_for_holidays": {"key": "countryOrRegionForHolidays", "type": "str"}, + "cv_step_size": {"key": "cvStepSize", "type": "int"}, + "feature_lags": {"key": "featureLags", "type": "str"}, + "forecast_horizon": {"key": "forecastHorizon", "type": "ForecastHorizon"}, + "frequency": {"key": "frequency", "type": "str"}, + "seasonality": {"key": "seasonality", "type": "Seasonality"}, + "short_series_handling_config": {"key": "shortSeriesHandlingConfig", "type": "str"}, + "target_aggregate_function": {"key": "targetAggregateFunction", "type": "str"}, + "target_lags": {"key": "targetLags", "type": "TargetLags"}, + "target_rolling_window_size": {"key": "targetRollingWindowSize", "type": "TargetRollingWindowSize"}, + "time_column_name": {"key": "timeColumnName", "type": "str"}, + "time_series_id_column_names": {"key": "timeSeriesIdColumnNames", "type": "[str]"}, + "use_stl": {"key": "useStl", "type": "str"}, + } + + def __init__( + self, + *, + country_or_region_for_holidays: Optional[str] = None, + cv_step_size: Optional[int] = None, + feature_lags: Optional[Union[str, "_models.FeatureLags"]] = None, + forecast_horizon: Optional["_models.ForecastHorizon"] = None, + frequency: Optional[str] = None, + seasonality: Optional["_models.Seasonality"] = None, + short_series_handling_config: Optional[Union[str, "_models.ShortSeriesHandlingConfiguration"]] = None, + target_aggregate_function: Optional[Union[str, "_models.TargetAggregationFunction"]] = None, + target_lags: Optional["_models.TargetLags"] = None, + target_rolling_window_size: Optional["_models.TargetRollingWindowSize"] = None, + time_column_name: Optional[str] = None, + time_series_id_column_names: Optional[List[str]] = None, + use_stl: Optional[Union[str, "_models.UseStl"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword country_or_region_for_holidays: Country or region for holidays for forecasting tasks. + These should be ISO 3166 two-letter country/region codes, for example 'US' or 'GB'. + :paramtype country_or_region_for_holidays: str + :keyword cv_step_size: Number of periods between the origin time of one CV fold and the next + fold. For + example, if ``CVStepSize`` = 3 for daily data, the origin time for each fold will be + three days apart. + :paramtype cv_step_size: int + :keyword feature_lags: Flag for generating lags for the numeric features with 'auto' or null. + Known values are: "None" and "Auto". + :paramtype feature_lags: str or ~azure.mgmt.machinelearningservices.models.FeatureLags + :keyword forecast_horizon: The desired maximum forecast horizon in units of time-series + frequency. + :paramtype forecast_horizon: ~azure.mgmt.machinelearningservices.models.ForecastHorizon + :keyword frequency: When forecasting, this parameter represents the period with which the + forecast is desired, for example daily, weekly, yearly, etc. The forecast frequency is dataset + frequency by default. + :paramtype frequency: str + :keyword seasonality: Set time series seasonality as an integer multiple of the series + frequency. + If seasonality is set to 'auto', it will be inferred. + :paramtype seasonality: ~azure.mgmt.machinelearningservices.models.Seasonality + :keyword short_series_handling_config: The parameter defining how if AutoML should handle short + time series. Known values are: "None", "Auto", "Pad", and "Drop". + :paramtype short_series_handling_config: str or + ~azure.mgmt.machinelearningservices.models.ShortSeriesHandlingConfiguration + :keyword target_aggregate_function: The function to be used to aggregate the time series target + column to conform to a user specified frequency. + If the TargetAggregateFunction is set i.e. not 'None', but the freq parameter is not set, the + error is raised. The possible target aggregation functions are: "sum", "max", "min" and "mean". + Known values are: "None", "Sum", "Max", "Min", and "Mean". + :paramtype target_aggregate_function: str or + ~azure.mgmt.machinelearningservices.models.TargetAggregationFunction + :keyword target_lags: The number of past periods to lag from the target column. + :paramtype target_lags: ~azure.mgmt.machinelearningservices.models.TargetLags + :keyword target_rolling_window_size: The number of past periods used to create a rolling window + average of the target column. + :paramtype target_rolling_window_size: + ~azure.mgmt.machinelearningservices.models.TargetRollingWindowSize + :keyword time_column_name: The name of the time column. This parameter is required when + forecasting to specify the datetime column in the input data used for building the time series + and inferring its frequency. + :paramtype time_column_name: str + :keyword time_series_id_column_names: The names of columns used to group a timeseries. It can + be used to create multiple series. + If grain is not defined, the data set is assumed to be one time-series. This parameter is used + with task type forecasting. + :paramtype time_series_id_column_names: list[str] + :keyword use_stl: Configure STL Decomposition of the time-series target column. Known values + are: "None", "Season", and "SeasonTrend". + :paramtype use_stl: str or ~azure.mgmt.machinelearningservices.models.UseStl + """ + super().__init__(**kwargs) + self.country_or_region_for_holidays = country_or_region_for_holidays + self.cv_step_size = cv_step_size + self.feature_lags = feature_lags + self.forecast_horizon = forecast_horizon + self.frequency = frequency + self.seasonality = seasonality + self.short_series_handling_config = short_series_handling_config + self.target_aggregate_function = target_aggregate_function + self.target_lags = target_lags + self.target_rolling_window_size = target_rolling_window_size + self.time_column_name = time_column_name + self.time_series_id_column_names = time_series_id_column_names + self.use_stl = use_stl + + +class ForecastingTrainingSettings(TrainingSettings): + """Forecasting Training related configuration. + + :ivar enable_dnn_training: Enable recommendation of DNN models. + :vartype enable_dnn_training: bool + :ivar enable_model_explainability: Flag to turn on explainability on best model. + :vartype enable_model_explainability: bool + :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :vartype enable_onnx_compatible_models: bool + :ivar enable_stack_ensemble: Enable stack ensemble run. + :vartype enable_stack_ensemble: bool + :ivar enable_vote_ensemble: Enable voting ensemble run. + :vartype enable_vote_ensemble: bool + :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :vartype ensemble_model_download_timeout: ~datetime.timedelta + :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :vartype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar allowed_training_algorithms: Allowed models for forecasting task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :ivar blocked_training_algorithms: Blocked models for forecasting task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + """ + + _attribute_map = { + "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, + "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, + "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, + "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, + "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, + "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, + "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, + "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, + } + + def __init__( + self, + *, + enable_dnn_training: bool = False, + enable_model_explainability: bool = True, + enable_onnx_compatible_models: bool = False, + enable_stack_ensemble: bool = True, + enable_vote_ensemble: bool = True, + ensemble_model_download_timeout: datetime.timedelta = "PT5M", + stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.ForecastingModels"]]] = None, + **kwargs: Any + ) -> None: + """ + :keyword enable_dnn_training: Enable recommendation of DNN models. + :paramtype enable_dnn_training: bool + :keyword enable_model_explainability: Flag to turn on explainability on best model. + :paramtype enable_model_explainability: bool + :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :paramtype enable_onnx_compatible_models: bool + :keyword enable_stack_ensemble: Enable stack ensemble run. + :paramtype enable_stack_ensemble: bool + :keyword enable_vote_ensemble: Enable voting ensemble run. + :paramtype enable_vote_ensemble: bool + :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :paramtype ensemble_model_download_timeout: ~datetime.timedelta + :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :paramtype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword allowed_training_algorithms: Allowed models for forecasting task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + :keyword blocked_training_algorithms: Blocked models for forecasting task. + :paramtype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.ForecastingModels] + """ + super().__init__( + enable_dnn_training=enable_dnn_training, + enable_model_explainability=enable_model_explainability, + enable_onnx_compatible_models=enable_onnx_compatible_models, + enable_stack_ensemble=enable_stack_ensemble, + enable_vote_ensemble=enable_vote_ensemble, + ensemble_model_download_timeout=ensemble_model_download_timeout, + stack_ensemble_settings=stack_ensemble_settings, + **kwargs + ) + self.allowed_training_algorithms = allowed_training_algorithms + self.blocked_training_algorithms = blocked_training_algorithms + + +class FQDNEndpoint(_serialization.Model): + """FQDNEndpoint. + + :ivar domain_name: + :vartype domain_name: str + :ivar endpoint_details: + :vartype endpoint_details: list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + """ + + _attribute_map = { + "domain_name": {"key": "domainName", "type": "str"}, + "endpoint_details": {"key": "endpointDetails", "type": "[FQDNEndpointDetail]"}, + } + + def __init__( + self, + *, + domain_name: Optional[str] = None, + endpoint_details: Optional[List["_models.FQDNEndpointDetail"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_name: + :paramtype domain_name: str + :keyword endpoint_details: + :paramtype endpoint_details: + list[~azure.mgmt.machinelearningservices.models.FQDNEndpointDetail] + """ + super().__init__(**kwargs) + self.domain_name = domain_name + self.endpoint_details = endpoint_details + + +class FQDNEndpointDetail(_serialization.Model): + """FQDNEndpointDetail. + + :ivar port: + :vartype port: int + """ + + _attribute_map = { + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, port: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword port: + :paramtype port: int + """ + super().__init__(**kwargs) + self.port = port + + +class FQDNEndpoints(_serialization.Model): + """FQDNEndpoints. + + :ivar category: + :vartype category: str + :ivar endpoints: + :vartype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + """ + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "[FQDNEndpoint]"}, + } + + def __init__( + self, *, category: Optional[str] = None, endpoints: Optional[List["_models.FQDNEndpoint"]] = None, **kwargs: Any + ) -> None: + """ + :keyword category: + :paramtype category: str + :keyword endpoints: + :paramtype endpoints: list[~azure.mgmt.machinelearningservices.models.FQDNEndpoint] + """ + super().__init__(**kwargs) + self.category = category + self.endpoints = endpoints + + +class FQDNEndpointsPropertyBag(_serialization.Model): + """Property bag for FQDN endpoints result. + + :ivar properties: + :vartype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "FQDNEndpoints"}, + } + + def __init__(self, *, properties: Optional["_models.FQDNEndpoints"] = None, **kwargs: Any) -> None: + """ + :keyword properties: + :paramtype properties: ~azure.mgmt.machinelearningservices.models.FQDNEndpoints + """ + super().__init__(**kwargs) + self.properties = properties + + +class OutboundRule(_serialization.Model): + """Outbound Rule for the managed network of a machine learning workspace. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + FqdnOutboundRule, PrivateEndpointOutboundRule, ServiceTagOutboundRule + + 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 server. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Type of a managed network Outbound Rule of a machine learning workspace. Required. + Known values are: "FQDN", "PrivateEndpoint", and "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + """ + + _validation = { + "parent_rule_names": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "parent_rule_names": {"key": "parentRuleNames", "type": "[str]"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + _subtype_map = { + "type": { + "FQDN": "FqdnOutboundRule", + "PrivateEndpoint": "PrivateEndpointOutboundRule", + "ServiceTag": "ServiceTagOutboundRule", + } + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + """ + super().__init__(**kwargs) + self.category = category + self.parent_rule_names = None + self.status = status + self.type: Optional[str] = None + + +class FqdnOutboundRule(OutboundRule): + """FQDN Outbound Rule for the managed network of a machine learning workspace. + + 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 server. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Type of a managed network Outbound Rule of a machine learning workspace. Required. + Known values are: "FQDN", "PrivateEndpoint", and "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: + :vartype destination: str + """ + + _validation = { + "parent_rule_names": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "category": {"key": "category", "type": "str"}, + "parent_rule_names": {"key": "parentRuleNames", "type": "[str]"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "destination": {"key": "destination", "type": "str"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + destination: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: + :paramtype destination: str + """ + super().__init__(category=category, status=status, **kwargs) + self.type: str = "FQDN" + self.destination = destination + + +class GetBlobReferenceForConsumptionDto(_serialization.Model): + """GetBlobReferenceForConsumptionDto. + + :ivar blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. + :vartype blob_uri: str + :ivar credential: Credential info to access storage account. + :vartype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential + :ivar storage_account_arm_id: The ARM id of the storage account. + :vartype storage_account_arm_id: str + """ + + _attribute_map = { + "blob_uri": {"key": "blobUri", "type": "str"}, + "credential": {"key": "credential", "type": "DataReferenceCredential"}, + "storage_account_arm_id": {"key": "storageAccountArmId", "type": "str"}, + } + + def __init__( + self, + *, + blob_uri: Optional[str] = None, + credential: Optional["_models.DataReferenceCredential"] = None, + storage_account_arm_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_uri: Blob uri, example: https://blob.windows.core.net/Container/Path. + :paramtype blob_uri: str + :keyword credential: Credential info to access storage account. + :paramtype credential: ~azure.mgmt.machinelearningservices.models.DataReferenceCredential + :keyword storage_account_arm_id: The ARM id of the storage account. + :paramtype storage_account_arm_id: str + """ + super().__init__(**kwargs) + self.blob_uri = blob_uri + self.credential = credential + self.storage_account_arm_id = storage_account_arm_id + + +class GetBlobReferenceSASRequestDto(_serialization.Model): + """BlobReferenceSASRequest for getBlobReferenceSAS API. + + :ivar asset_id: Id of the asset to be accessed. + :vartype asset_id: str + :ivar blob_uri: Blob uri of the asset to be accessed. + :vartype blob_uri: str + """ + + _attribute_map = { + "asset_id": {"key": "assetId", "type": "str"}, + "blob_uri": {"key": "blobUri", "type": "str"}, + } + + def __init__(self, *, asset_id: Optional[str] = None, blob_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword asset_id: Id of the asset to be accessed. + :paramtype asset_id: str + :keyword blob_uri: Blob uri of the asset to be accessed. + :paramtype blob_uri: str + """ + super().__init__(**kwargs) + self.asset_id = asset_id + self.blob_uri = blob_uri + + +class GetBlobReferenceSASResponseDto(_serialization.Model): + """BlobReferenceSASResponse for getBlobReferenceSAS API. + + :ivar blob_reference_for_consumption: Blob reference for consumption details. + :vartype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto + """ + + _attribute_map = { + "blob_reference_for_consumption": { + "key": "blobReferenceForConsumption", + "type": "GetBlobReferenceForConsumptionDto", + }, + } + + def __init__( + self, + *, + blob_reference_for_consumption: Optional["_models.GetBlobReferenceForConsumptionDto"] = None, + **kwargs: Any + ) -> None: + """ + :keyword blob_reference_for_consumption: Blob reference for consumption details. + :paramtype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.GetBlobReferenceForConsumptionDto + """ + super().__init__(**kwargs) + self.blob_reference_for_consumption = blob_reference_for_consumption + + +class GridSamplingAlgorithm(SamplingAlgorithm): + """Defines a Sampling Algorithm that exhaustively generates every value combination in the space. + + All required parameters must be populated in order to send to server. + + :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter + values, along with configuration properties. Required. Known values are: "Grid", "Random", and + "Bayesian". + :vartype sampling_algorithm_type: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + """ + + _validation = { + "sampling_algorithm_type": {"required": True}, + } + + _attribute_map = { + "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.sampling_algorithm_type: str = "Grid" + + +class GroupEnvironmentConfiguration(_serialization.Model): + """Environment configuration options. + + :ivar environment_id: ARM resource ID of the environment specification for the inference pool. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the inference pool. + :vartype environment_variables: + list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar startup_probe: This verifies whether the application within a container is started. + Startup probes run before any other probe, and, unless it finishes successfully, disables other + probes. + :vartype startup_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + """ + + _attribute_map = { + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "[StringKeyValuePair]"}, + "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, + "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, + "startup_probe": {"key": "startupProbe", "type": "ProbeSettings"}, + } + + def __init__( + self, + *, + environment_id: Optional[str] = None, + environment_variables: Optional[List["_models.StringKeyValuePair"]] = None, + liveness_probe: Optional["_models.ProbeSettings"] = None, + readiness_probe: Optional["_models.ProbeSettings"] = None, + startup_probe: Optional["_models.ProbeSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword environment_id: ARM resource ID of the environment specification for the inference + pool. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the inference pool. + :paramtype environment_variables: + list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword startup_probe: This verifies whether the application within a container is started. + Startup probes run before any other probe, and, unless it finishes successfully, disables other + probes. + :paramtype startup_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + """ + super().__init__(**kwargs) + self.environment_id = environment_id + self.environment_variables = environment_variables + self.liveness_probe = liveness_probe + self.readiness_probe = readiness_probe + self.startup_probe = startup_probe + + +class GroupModelConfiguration(_serialization.Model): + """Model configuration options. + + :ivar model_id: The URI path to the model. + :vartype model_id: str + """ + + _attribute_map = { + "model_id": {"key": "modelId", "type": "str"}, + } + + def __init__(self, *, model_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword model_id: The URI path to the model. + :paramtype model_id: str + """ + super().__init__(**kwargs) + self.model_id = model_id + + +class GroupStatus(_serialization.Model): + """GroupStatus. + + :ivar actual_capacity_info: Gets or sets the actual capacity info for the group. + :vartype actual_capacity_info: ~azure.mgmt.machinelearningservices.models.ActualCapacityInfo + :ivar endpoint_count: Gets or sets the actual number of endpoints in the group. + :vartype endpoint_count: int + :ivar requested_capacity: Gets or sets the request number of instances for the group. + :vartype requested_capacity: int + """ + + _attribute_map = { + "actual_capacity_info": {"key": "actualCapacityInfo", "type": "ActualCapacityInfo"}, + "endpoint_count": {"key": "endpointCount", "type": "int"}, + "requested_capacity": {"key": "requestedCapacity", "type": "int"}, + } + + def __init__( + self, + *, + actual_capacity_info: Optional["_models.ActualCapacityInfo"] = None, + endpoint_count: int = 0, + requested_capacity: int = 0, + **kwargs: Any + ) -> None: + """ + :keyword actual_capacity_info: Gets or sets the actual capacity info for the group. + :paramtype actual_capacity_info: ~azure.mgmt.machinelearningservices.models.ActualCapacityInfo + :keyword endpoint_count: Gets or sets the actual number of endpoints in the group. + :paramtype endpoint_count: int + :keyword requested_capacity: Gets or sets the request number of instances for the group. + :paramtype requested_capacity: int + """ + super().__init__(**kwargs) + self.actual_capacity_info = actual_capacity_info + self.endpoint_count = endpoint_count + self.requested_capacity = requested_capacity + + +class HDInsightSchema(_serialization.Model): + """HDInsightSchema. + + :ivar properties: HDInsight compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "HDInsightProperties"}, + } + + def __init__(self, *, properties: Optional["_models.HDInsightProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: HDInsight compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class HDInsight(Compute, HDInsightSchema): # pylint: disable=too-many-instance-attributes + """A HDInsight 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 server. + + :ivar properties: HDInsight compute properties. + :vartype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :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 + :ivar compute_location: Location for the underlying 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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "HDInsightProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + } + + def __init__( + self, + *, + properties: Optional["_models.HDInsightProperties"] = None, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: HDInsight compute properties. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.HDInsightProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool + """ + super().__init__( + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, + properties=properties, + **kwargs + ) + self.properties = properties + self.compute_type: str = "HDInsight" + self.compute_location = compute_location + self.provisioning_state = None + self.description = description + self.created_on = None + self.modified_on = None + self.resource_id = resource_id + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = disable_local_auth + + +class HDInsightProperties(_serialization.Model): + """HDInsight compute properties. + + :ivar ssh_port: Port open for ssh connections on the master node of the cluster. + :vartype ssh_port: int + :ivar address: Public IP address of the master node of the cluster. + :vartype address: str + :ivar administrator_account: Admin credentials for master node of the cluster. + :vartype administrator_account: + ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials + """ + + _attribute_map = { + "ssh_port": {"key": "sshPort", "type": "int"}, + "address": {"key": "address", "type": "str"}, + "administrator_account": {"key": "administratorAccount", "type": "VirtualMachineSshCredentials"}, + } + + def __init__( + self, + *, + ssh_port: Optional[int] = None, + address: Optional[str] = None, + administrator_account: Optional["_models.VirtualMachineSshCredentials"] = None, + **kwargs: Any + ) -> None: + """ + :keyword ssh_port: Port open for ssh connections on the master node of the cluster. + :paramtype ssh_port: int + :keyword address: Public IP address of the master node of the cluster. + :paramtype address: str + :keyword administrator_account: Admin credentials for master node of the cluster. + :paramtype administrator_account: + ~azure.mgmt.machinelearningservices.models.VirtualMachineSshCredentials + """ + super().__init__(**kwargs) + self.ssh_port = ssh_port + self.address = address + self.administrator_account = administrator_account + + +class IdAssetReference(AssetReferenceBase): + """Reference to an asset via its ARM resource ID. + + All required parameters must be populated in order to send to server. + + :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values + are: "Id", "DataPath", and "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar asset_id: [Required] ARM resource ID of the asset. Required. + :vartype asset_id: str + """ + + _validation = { + "reference_type": {"required": True}, + "asset_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "reference_type": {"key": "referenceType", "type": "str"}, + "asset_id": {"key": "assetId", "type": "str"}, + } + + def __init__(self, *, asset_id: str, **kwargs: Any) -> None: + """ + :keyword asset_id: [Required] ARM resource ID of the asset. Required. + :paramtype asset_id: str + """ + super().__init__(**kwargs) + self.reference_type: str = "Id" + self.asset_id = asset_id + + +class IdentityForCmk(_serialization.Model): + """Identity object used for encryption. + + :ivar user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key from + keyVault. + :vartype user_assigned_identity: str + """ + + _attribute_map = { + "user_assigned_identity": {"key": "userAssignedIdentity", "type": "str"}, + } + + def __init__(self, *, user_assigned_identity: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword user_assigned_identity: UserAssignedIdentity to be used to fetch the encryption key + from keyVault. + :paramtype user_assigned_identity: str + """ + super().__init__(**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: Any) -> None: + """ + :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 Environment images (custom and curated). Known values are: "docker" and "azureml". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :ivar reference: Image reference URL if type is docker. Environment name if type is azureml. + :vartype reference: str + :ivar version: Version of image being used. If latest then skip this field. + :vartype version: str + """ + + _attribute_map = { + "additional_properties": {"key": "", "type": "{object}"}, + "type": {"key": "type", "type": "str"}, + "reference": {"key": "reference", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + type: Union[str, "_models.ImageType"] = "docker", + reference: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 Environment images (custom and curated). Known values are: "docker" and "azureml". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ImageType + :keyword reference: Image reference URL if type is docker. Environment name if type is azureml. + :paramtype reference: str + :keyword version: Version of image being used. If latest then skip this field. + :paramtype version: str + """ + super().__init__(**kwargs) + self.additional_properties = additional_properties + self.type = type + self.reference = reference + self.version = version + + +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. + + All required parameters must be populated in order to send to server. + + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + """ + + _validation = { + "limit_settings": {"required": True}, + } + + _attribute_map = { + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + } + + def __init__( + self, + *, + limit_settings: "_models.ImageLimitSettings", + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + """ + super().__init__(**kwargs) + self.limit_settings = limit_settings + self.sweep_settings = sweep_settings + self.validation_data = validation_data + self.validation_data_size = validation_data_size + + +class ImageClassificationBase(ImageVertical): + """ImageClassificationBase. + + All required parameters must be populated in order to send to server. + + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + """ + + _validation = { + "limit_settings": {"required": True}, + } + + _attribute_map = { + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, + } + + def __init__( + self, + *, + limit_settings: "_models.ImageLimitSettings", + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsClassification"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + **kwargs + ) + self.model_settings = model_settings + self.search_space = search_space + + +class ImageClassification(ImageClassificationBase, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Image Classification. Multi-class image classification is used when an image is classified with + only a single label + from a set of classes - e.g. each image is classified as either an image of a 'cat' or a 'dog' + or a 'duck'. + + All required parameters must be populated in order to send to server. + + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :ivar primary_metric: Primary metric to optimize for this task. Known values are: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and + "PrecisionScoreWeighted". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + "limit_settings": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + } + + def __init__( + self, + *, + training_data: "_models.MLTableJobInput", + limit_settings: "_models.ImageLimitSettings", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsClassification"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, + primary_metric: Optional[Union[str, "_models.ClassificationPrimaryMetrics"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword primary_metric: Primary metric to optimize for this task. Known values are: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", and + "PrecisionScoreWeighted". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationPrimaryMetrics + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + model_settings=model_settings, + search_space=search_space, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "ImageClassification" + self.training_data = training_data + self.primary_metric = primary_metric + self.limit_settings = limit_settings + self.sweep_settings = sweep_settings + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.model_settings = model_settings + self.search_space = search_space + + +class ImageClassificationMultilabel( + ImageClassificationBase, AutoMLVertical +): # pylint: disable=too-many-instance-attributes + """Image Classification Multilabel. Multi-label image classification is used when an image could + have one or more labels + from a set of labels - e.g. an image could be labeled with both 'cat' and 'dog'. + + All required parameters must be populated in order to send to server. + + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :ivar primary_metric: Primary metric to optimize for this task. Known values are: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted", and "IOU". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + "limit_settings": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsClassification"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsClassification]"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + } + + def __init__( + self, + *, + training_data: "_models.MLTableJobInput", + limit_settings: "_models.ImageLimitSettings", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsClassification"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsClassification"]] = None, + primary_metric: Optional[Union[str, "_models.ClassificationMultilabelPrimaryMetrics"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsClassification + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsClassification] + :keyword primary_metric: Primary metric to optimize for this task. Known values are: + "AUCWeighted", "Accuracy", "NormMacroRecall", "AveragePrecisionScoreWeighted", + "PrecisionScoreWeighted", and "IOU". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ClassificationMultilabelPrimaryMetrics + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + model_settings=model_settings, + search_space=search_space, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "ImageClassificationMultilabel" + self.training_data = training_data + self.primary_metric = primary_metric + self.limit_settings = limit_settings + self.sweep_settings = sweep_settings + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.model_settings = model_settings + self.search_space = search_space + + +class ImageObjectDetectionBase(ImageVertical): + """ImageObjectDetectionBase. + + All required parameters must be populated in order to send to server. + + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + """ + + _validation = { + "limit_settings": {"required": True}, + } + + _attribute_map = { + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, + } + + def __init__( + self, + *, + limit_settings: "_models.ImageLimitSettings", + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + **kwargs + ) + self.model_settings = model_settings + self.search_space = search_space + + +class ImageInstanceSegmentation( + ImageObjectDetectionBase, AutoMLVertical +): # pylint: disable=too-many-instance-attributes + """Image Instance Segmentation. Instance segmentation is used to identify objects in an image at + the pixel level, + drawing a polygon around each object in the image. + + All required parameters must be populated in order to send to server. + + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + "limit_settings": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + } + + def __init__( + self, + *, + training_data: "_models.MLTableJobInput", + limit_settings: "_models.ImageLimitSettings", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, + primary_metric: Optional[Union[str, "_models.InstanceSegmentationPrimaryMetrics"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.InstanceSegmentationPrimaryMetrics + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + model_settings=model_settings, + search_space=search_space, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "ImageInstanceSegmentation" + self.training_data = training_data + self.primary_metric = primary_metric + self.limit_settings = limit_settings + self.sweep_settings = sweep_settings + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.model_settings = model_settings + self.search_space = search_space + + +class ImageLimitSettings(_serialization.Model): + """Limit settings for the AutoML job. + + :ivar max_concurrent_trials: Maximum number of concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_trials: Maximum number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta + """ + + _attribute_map = { + "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, + "max_trials": {"key": "maxTrials", "type": "int"}, + "timeout": {"key": "timeout", "type": "duration"}, + } + + def __init__( + self, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any + ) -> None: + """ + :keyword max_concurrent_trials: Maximum number of concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_trials: Maximum number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.max_concurrent_trials = max_concurrent_trials + self.max_trials = max_trials + self.timeout = timeout + + +class ImageMetadata(_serialization.Model): + """Returns metadata about the operating system image for this compute instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 + :ivar os_patching_status: Metadata about the os patching. + :vartype os_patching_status: ~azure.mgmt.machinelearningservices.models.OsPatchingStatus + """ + + _validation = { + "os_patching_status": {"readonly": True}, + } + + _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"}, + "os_patching_status": {"key": "osPatchingStatus", "type": "OsPatchingStatus"}, + } + + def __init__( + self, + *, + current_image_version: Optional[str] = None, + latest_image_version: Optional[str] = None, + is_latest_os_image_version: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :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 + self.os_patching_status = None + + +class ImageModelDistributionSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Distribution expressions to sweep over values of model settings. + + :code:` + Some examples are: + ``` + ModelName = "choice('seresnext', 'resnest50')"; + LearningRate = "uniform(0.001, 0.01)"; + LayersToFreeze = "choice(0, 2)"; + ```` + All distributions can be specified as distribution_name(min, max) or choice(val1, val2, ..., + valn) + where distribution name can be: uniform, quniform, loguniform, etc + For more details on how to compose distribution expressions please check the documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + """ + + _attribute_map = { + "ams_gradient": {"key": "amsGradient", "type": "str"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "str"}, + "beta2": {"key": "beta2", "type": "str"}, + "distributed": {"key": "distributed", "type": "str"}, + "early_stopping": {"key": "earlyStopping", "type": "str"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "str"}, + "nesterov": {"key": "nesterov", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "str"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, + "weight_decay": {"key": "weightDecay", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + ams_gradient: Optional[str] = None, + augmentations: Optional[str] = None, + beta1: Optional[str] = None, + beta2: Optional[str] = None, + distributed: Optional[str] = None, + early_stopping: Optional[str] = None, + early_stopping_delay: Optional[str] = None, + early_stopping_patience: Optional[str] = None, + enable_onnx_normalization: Optional[str] = None, + evaluation_frequency: Optional[str] = None, + gradient_accumulation_step: Optional[str] = None, + layers_to_freeze: Optional[str] = None, + learning_rate: Optional[str] = None, + learning_rate_scheduler: Optional[str] = None, + model_name: Optional[str] = None, + momentum: Optional[str] = None, + nesterov: Optional[str] = None, + number_of_epochs: Optional[str] = None, + number_of_workers: Optional[str] = None, + optimizer: Optional[str] = None, + random_seed: Optional[str] = None, + step_lr_gamma: Optional[str] = None, + step_lr_step_size: Optional[str] = None, + training_batch_size: Optional[str] = None, + validation_batch_size: Optional[str] = None, + warmup_cosine_lr_cycles: Optional[str] = None, + warmup_cosine_lr_warmup_epochs: Optional[str] = None, + weight_decay: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + """ + super().__init__(**kwargs) + self.ams_gradient = ams_gradient + self.augmentations = augmentations + self.beta1 = beta1 + self.beta2 = beta2 + self.distributed = distributed + self.early_stopping = early_stopping + self.early_stopping_delay = early_stopping_delay + self.early_stopping_patience = early_stopping_patience + self.enable_onnx_normalization = enable_onnx_normalization + self.evaluation_frequency = evaluation_frequency + self.gradient_accumulation_step = gradient_accumulation_step + self.layers_to_freeze = layers_to_freeze + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.momentum = momentum + self.nesterov = nesterov + self.number_of_epochs = number_of_epochs + self.number_of_workers = number_of_workers + self.optimizer = optimizer + self.random_seed = random_seed + self.step_lr_gamma = step_lr_gamma + self.step_lr_step_size = step_lr_step_size + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_cosine_lr_cycles = warmup_cosine_lr_cycles + self.warmup_cosine_lr_warmup_epochs = warmup_cosine_lr_warmup_epochs + self.weight_decay = weight_decay + + +class ImageModelDistributionSettingsClassification( + ImageModelDistributionSettings +): # pylint: disable=too-many-instance-attributes,name-too-long + """Distribution expressions to sweep over values of model settings. + + :code:` + Some examples are: + ``` + ModelName = "choice('seresnext', 'resnest50')"; + LearningRate = "uniform(0.001, 0.01)"; + LayersToFreeze = "choice(0, 2)"; + ```` + For more details on how to compose distribution expressions please check the documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + :ivar training_crop_size: Image crop size that is input to the neural network for the training + dataset. Must be a positive integer. + :vartype training_crop_size: str + :ivar validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :vartype validation_crop_size: str + :ivar validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :vartype validation_resize_size: str + :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :vartype weighted_loss: str + """ + + _attribute_map = { + "ams_gradient": {"key": "amsGradient", "type": "str"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "str"}, + "beta2": {"key": "beta2", "type": "str"}, + "distributed": {"key": "distributed", "type": "str"}, + "early_stopping": {"key": "earlyStopping", "type": "str"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "str"}, + "nesterov": {"key": "nesterov", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "str"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, + "weight_decay": {"key": "weightDecay", "type": "str"}, + "training_crop_size": {"key": "trainingCropSize", "type": "str"}, + "validation_crop_size": {"key": "validationCropSize", "type": "str"}, + "validation_resize_size": {"key": "validationResizeSize", "type": "str"}, + "weighted_loss": {"key": "weightedLoss", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + ams_gradient: Optional[str] = None, + augmentations: Optional[str] = None, + beta1: Optional[str] = None, + beta2: Optional[str] = None, + distributed: Optional[str] = None, + early_stopping: Optional[str] = None, + early_stopping_delay: Optional[str] = None, + early_stopping_patience: Optional[str] = None, + enable_onnx_normalization: Optional[str] = None, + evaluation_frequency: Optional[str] = None, + gradient_accumulation_step: Optional[str] = None, + layers_to_freeze: Optional[str] = None, + learning_rate: Optional[str] = None, + learning_rate_scheduler: Optional[str] = None, + model_name: Optional[str] = None, + momentum: Optional[str] = None, + nesterov: Optional[str] = None, + number_of_epochs: Optional[str] = None, + number_of_workers: Optional[str] = None, + optimizer: Optional[str] = None, + random_seed: Optional[str] = None, + step_lr_gamma: Optional[str] = None, + step_lr_step_size: Optional[str] = None, + training_batch_size: Optional[str] = None, + validation_batch_size: Optional[str] = None, + warmup_cosine_lr_cycles: Optional[str] = None, + warmup_cosine_lr_warmup_epochs: Optional[str] = None, + weight_decay: Optional[str] = None, + training_crop_size: Optional[str] = None, + validation_crop_size: Optional[str] = None, + validation_resize_size: Optional[str] = None, + weighted_loss: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + :keyword training_crop_size: Image crop size that is input to the neural network for the + training dataset. Must be a positive integer. + :paramtype training_crop_size: str + :keyword validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :paramtype validation_crop_size: str + :keyword validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :paramtype validation_resize_size: str + :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :paramtype weighted_loss: str + """ + super().__init__( + ams_gradient=ams_gradient, + augmentations=augmentations, + beta1=beta1, + beta2=beta2, + distributed=distributed, + early_stopping=early_stopping, + early_stopping_delay=early_stopping_delay, + early_stopping_patience=early_stopping_patience, + enable_onnx_normalization=enable_onnx_normalization, + evaluation_frequency=evaluation_frequency, + gradient_accumulation_step=gradient_accumulation_step, + layers_to_freeze=layers_to_freeze, + learning_rate=learning_rate, + learning_rate_scheduler=learning_rate_scheduler, + model_name=model_name, + momentum=momentum, + nesterov=nesterov, + number_of_epochs=number_of_epochs, + number_of_workers=number_of_workers, + optimizer=optimizer, + random_seed=random_seed, + step_lr_gamma=step_lr_gamma, + step_lr_step_size=step_lr_step_size, + training_batch_size=training_batch_size, + validation_batch_size=validation_batch_size, + warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, + warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, + weight_decay=weight_decay, + **kwargs + ) + self.training_crop_size = training_crop_size + self.validation_crop_size = validation_crop_size + self.validation_resize_size = validation_resize_size + self.weighted_loss = weighted_loss + + +class ImageModelDistributionSettingsObjectDetection( + ImageModelDistributionSettings +): # pylint: disable=too-many-instance-attributes,name-too-long + """Distribution expressions to sweep over values of model settings. + + :code:` + Some examples are: + ``` + ModelName = "choice('seresnext', 'resnest50')"; + LearningRate = "uniform(0.001, 0.01)"; + LayersToFreeze = "choice(0, 2)"; + ```` + For more details on how to compose distribution expressions please check the documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-tune-hyperparameters + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: str + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: str + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: str + :ivar distributed: Whether to use distributer training. + :vartype distributed: str + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: str + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: str + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: str + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: str + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: str + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: str + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: str + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: str + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :vartype learning_rate_scheduler: str + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: str + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: str + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: str + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: str + :ivar optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :vartype optimizer: str + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: str + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: str + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: str + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: str + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: str + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: str + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: str + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: str + :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must + be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype box_detections_per_image: str + :ivar box_score_threshold: During inference, only return proposals with a classification score + greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :vartype box_score_threshold: str + :ivar image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype image_size: str + :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype max_size: str + :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype min_size: str + :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype model_size: str + :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype multi_scale: str + :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + float in the range [0, 1]. + :vartype nms_iou_threshold: str + :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not + be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_grid_size: str + :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float + in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_overlap_ratio: str + :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + NMS: Non-maximum suppression. + :vartype tile_predictions_nms_threshold: str + :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be + float in the range [0, 1]. + :vartype validation_iou_threshold: str + :ivar validation_metric_type: Metric computation method to use for validation metrics. Must be + 'none', 'coco', 'voc', or 'coco_voc'. + :vartype validation_metric_type: str + """ + + _attribute_map = { + "ams_gradient": {"key": "amsGradient", "type": "str"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "str"}, + "beta2": {"key": "beta2", "type": "str"}, + "distributed": {"key": "distributed", "type": "str"}, + "early_stopping": {"key": "earlyStopping", "type": "str"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "str"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "str"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "str"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "str"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "str"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "str"}, + "learning_rate": {"key": "learningRate", "type": "str"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "str"}, + "nesterov": {"key": "nesterov", "type": "str"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "str"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "str"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "str"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "str"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "str"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "str"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "str"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "str"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "str"}, + "weight_decay": {"key": "weightDecay", "type": "str"}, + "box_detections_per_image": {"key": "boxDetectionsPerImage", "type": "str"}, + "box_score_threshold": {"key": "boxScoreThreshold", "type": "str"}, + "image_size": {"key": "imageSize", "type": "str"}, + "max_size": {"key": "maxSize", "type": "str"}, + "min_size": {"key": "minSize", "type": "str"}, + "model_size": {"key": "modelSize", "type": "str"}, + "multi_scale": {"key": "multiScale", "type": "str"}, + "nms_iou_threshold": {"key": "nmsIouThreshold", "type": "str"}, + "tile_grid_size": {"key": "tileGridSize", "type": "str"}, + "tile_overlap_ratio": {"key": "tileOverlapRatio", "type": "str"}, + "tile_predictions_nms_threshold": {"key": "tilePredictionsNmsThreshold", "type": "str"}, + "validation_iou_threshold": {"key": "validationIouThreshold", "type": "str"}, + "validation_metric_type": {"key": "validationMetricType", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + ams_gradient: Optional[str] = None, + augmentations: Optional[str] = None, + beta1: Optional[str] = None, + beta2: Optional[str] = None, + distributed: Optional[str] = None, + early_stopping: Optional[str] = None, + early_stopping_delay: Optional[str] = None, + early_stopping_patience: Optional[str] = None, + enable_onnx_normalization: Optional[str] = None, + evaluation_frequency: Optional[str] = None, + gradient_accumulation_step: Optional[str] = None, + layers_to_freeze: Optional[str] = None, + learning_rate: Optional[str] = None, + learning_rate_scheduler: Optional[str] = None, + model_name: Optional[str] = None, + momentum: Optional[str] = None, + nesterov: Optional[str] = None, + number_of_epochs: Optional[str] = None, + number_of_workers: Optional[str] = None, + optimizer: Optional[str] = None, + random_seed: Optional[str] = None, + step_lr_gamma: Optional[str] = None, + step_lr_step_size: Optional[str] = None, + training_batch_size: Optional[str] = None, + validation_batch_size: Optional[str] = None, + warmup_cosine_lr_cycles: Optional[str] = None, + warmup_cosine_lr_warmup_epochs: Optional[str] = None, + weight_decay: Optional[str] = None, + box_detections_per_image: Optional[str] = None, + box_score_threshold: Optional[str] = None, + image_size: Optional[str] = None, + max_size: Optional[str] = None, + min_size: Optional[str] = None, + model_size: Optional[str] = None, + multi_scale: Optional[str] = None, + nms_iou_threshold: Optional[str] = None, + tile_grid_size: Optional[str] = None, + tile_overlap_ratio: Optional[str] = None, + tile_predictions_nms_threshold: Optional[str] = None, + validation_iou_threshold: Optional[str] = None, + validation_metric_type: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: str + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: str + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: str + :keyword distributed: Whether to use distributer training. + :paramtype distributed: str + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: str + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: str + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: str + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: str + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: str + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: str + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: str + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: str + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. + :paramtype learning_rate_scheduler: str + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: str + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: str + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: str + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: str + :keyword optimizer: Type of optimizer. Must be either 'sgd', 'adam', or 'adamw'. + :paramtype optimizer: str + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: str + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: str + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: str + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: str + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: str + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: str + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: str + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: str + :keyword box_detections_per_image: Maximum number of detections per image, for all classes. + Must be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype box_detections_per_image: str + :keyword box_score_threshold: During inference, only return proposals with a classification + score greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :paramtype box_score_threshold: str + :keyword image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype image_size: str + :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype max_size: str + :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype min_size: str + :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype model_size: str + :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype multi_scale: str + :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + float in the range [0, 1]. + :paramtype nms_iou_threshold: str + :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must + not be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_grid_size: str + :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be + float in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_overlap_ratio: str + :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + NMS: Non-maximum suppression. + :paramtype tile_predictions_nms_threshold: str + :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must + be float in the range [0, 1]. + :paramtype validation_iou_threshold: str + :keyword validation_metric_type: Metric computation method to use for validation metrics. Must + be 'none', 'coco', 'voc', or 'coco_voc'. + :paramtype validation_metric_type: str + """ + super().__init__( + ams_gradient=ams_gradient, + augmentations=augmentations, + beta1=beta1, + beta2=beta2, + distributed=distributed, + early_stopping=early_stopping, + early_stopping_delay=early_stopping_delay, + early_stopping_patience=early_stopping_patience, + enable_onnx_normalization=enable_onnx_normalization, + evaluation_frequency=evaluation_frequency, + gradient_accumulation_step=gradient_accumulation_step, + layers_to_freeze=layers_to_freeze, + learning_rate=learning_rate, + learning_rate_scheduler=learning_rate_scheduler, + model_name=model_name, + momentum=momentum, + nesterov=nesterov, + number_of_epochs=number_of_epochs, + number_of_workers=number_of_workers, + optimizer=optimizer, + random_seed=random_seed, + step_lr_gamma=step_lr_gamma, + step_lr_step_size=step_lr_step_size, + training_batch_size=training_batch_size, + validation_batch_size=validation_batch_size, + warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, + warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, + weight_decay=weight_decay, + **kwargs + ) + self.box_detections_per_image = box_detections_per_image + self.box_score_threshold = box_score_threshold + self.image_size = image_size + self.max_size = max_size + self.min_size = min_size + self.model_size = model_size + self.multi_scale = multi_scale + self.nms_iou_threshold = nms_iou_threshold + self.tile_grid_size = tile_grid_size + self.tile_overlap_ratio = tile_overlap_ratio + self.tile_predictions_nms_threshold = tile_predictions_nms_threshold + self.validation_iou_threshold = validation_iou_threshold + self.validation_metric_type = validation_metric_type + + +class ImageModelSettings(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Settings used for training the model. + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + """ + + _attribute_map = { + "advanced_settings": {"key": "advancedSettings", "type": "str"}, + "ams_gradient": {"key": "amsGradient", "type": "bool"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "float"}, + "beta2": {"key": "beta2", "type": "float"}, + "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, + "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, + "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, + "distributed": {"key": "distributed", "type": "bool"}, + "early_stopping": {"key": "earlyStopping", "type": "bool"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "float"}, + "nesterov": {"key": "nesterov", "type": "bool"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "int"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, + "weight_decay": {"key": "weightDecay", "type": "float"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + advanced_settings: Optional[str] = None, + ams_gradient: Optional[bool] = None, + augmentations: Optional[str] = None, + beta1: Optional[float] = None, + beta2: Optional[float] = None, + checkpoint_frequency: Optional[int] = None, + checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, + checkpoint_run_id: Optional[str] = None, + distributed: Optional[bool] = None, + early_stopping: Optional[bool] = None, + early_stopping_delay: Optional[int] = None, + early_stopping_patience: Optional[int] = None, + enable_onnx_normalization: Optional[bool] = None, + evaluation_frequency: Optional[int] = None, + gradient_accumulation_step: Optional[int] = None, + layers_to_freeze: Optional[int] = None, + learning_rate: Optional[float] = None, + learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, + model_name: Optional[str] = None, + momentum: Optional[float] = None, + nesterov: Optional[bool] = None, + number_of_epochs: Optional[int] = None, + number_of_workers: Optional[int] = None, + optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, + random_seed: Optional[int] = None, + step_lr_gamma: Optional[float] = None, + step_lr_step_size: Optional[int] = None, + training_batch_size: Optional[int] = None, + validation_batch_size: Optional[int] = None, + warmup_cosine_lr_cycles: Optional[float] = None, + warmup_cosine_lr_warmup_epochs: Optional[int] = None, + weight_decay: Optional[float] = None, + **kwargs: Any + ) -> None: + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + """ + super().__init__(**kwargs) + self.advanced_settings = advanced_settings + self.ams_gradient = ams_gradient + self.augmentations = augmentations + self.beta1 = beta1 + self.beta2 = beta2 + self.checkpoint_frequency = checkpoint_frequency + self.checkpoint_model = checkpoint_model + self.checkpoint_run_id = checkpoint_run_id + self.distributed = distributed + self.early_stopping = early_stopping + self.early_stopping_delay = early_stopping_delay + self.early_stopping_patience = early_stopping_patience + self.enable_onnx_normalization = enable_onnx_normalization + self.evaluation_frequency = evaluation_frequency + self.gradient_accumulation_step = gradient_accumulation_step + self.layers_to_freeze = layers_to_freeze + self.learning_rate = learning_rate + self.learning_rate_scheduler = learning_rate_scheduler + self.model_name = model_name + self.momentum = momentum + self.nesterov = nesterov + self.number_of_epochs = number_of_epochs + self.number_of_workers = number_of_workers + self.optimizer = optimizer + self.random_seed = random_seed + self.step_lr_gamma = step_lr_gamma + self.step_lr_step_size = step_lr_step_size + self.training_batch_size = training_batch_size + self.validation_batch_size = validation_batch_size + self.warmup_cosine_lr_cycles = warmup_cosine_lr_cycles + self.warmup_cosine_lr_warmup_epochs = warmup_cosine_lr_warmup_epochs + self.weight_decay = weight_decay + + +class ImageModelSettingsClassification(ImageModelSettings): # pylint: disable=too-many-instance-attributes + """Settings used for training the model. + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + :ivar training_crop_size: Image crop size that is input to the neural network for the training + dataset. Must be a positive integer. + :vartype training_crop_size: int + :ivar validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :vartype validation_crop_size: int + :ivar validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :vartype validation_resize_size: int + :ivar weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :vartype weighted_loss: int + """ + + _attribute_map = { + "advanced_settings": {"key": "advancedSettings", "type": "str"}, + "ams_gradient": {"key": "amsGradient", "type": "bool"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "float"}, + "beta2": {"key": "beta2", "type": "float"}, + "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, + "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, + "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, + "distributed": {"key": "distributed", "type": "bool"}, + "early_stopping": {"key": "earlyStopping", "type": "bool"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "float"}, + "nesterov": {"key": "nesterov", "type": "bool"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "int"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, + "weight_decay": {"key": "weightDecay", "type": "float"}, + "training_crop_size": {"key": "trainingCropSize", "type": "int"}, + "validation_crop_size": {"key": "validationCropSize", "type": "int"}, + "validation_resize_size": {"key": "validationResizeSize", "type": "int"}, + "weighted_loss": {"key": "weightedLoss", "type": "int"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + advanced_settings: Optional[str] = None, + ams_gradient: Optional[bool] = None, + augmentations: Optional[str] = None, + beta1: Optional[float] = None, + beta2: Optional[float] = None, + checkpoint_frequency: Optional[int] = None, + checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, + checkpoint_run_id: Optional[str] = None, + distributed: Optional[bool] = None, + early_stopping: Optional[bool] = None, + early_stopping_delay: Optional[int] = None, + early_stopping_patience: Optional[int] = None, + enable_onnx_normalization: Optional[bool] = None, + evaluation_frequency: Optional[int] = None, + gradient_accumulation_step: Optional[int] = None, + layers_to_freeze: Optional[int] = None, + learning_rate: Optional[float] = None, + learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, + model_name: Optional[str] = None, + momentum: Optional[float] = None, + nesterov: Optional[bool] = None, + number_of_epochs: Optional[int] = None, + number_of_workers: Optional[int] = None, + optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, + random_seed: Optional[int] = None, + step_lr_gamma: Optional[float] = None, + step_lr_step_size: Optional[int] = None, + training_batch_size: Optional[int] = None, + validation_batch_size: Optional[int] = None, + warmup_cosine_lr_cycles: Optional[float] = None, + warmup_cosine_lr_warmup_epochs: Optional[int] = None, + weight_decay: Optional[float] = None, + training_crop_size: Optional[int] = None, + validation_crop_size: Optional[int] = None, + validation_resize_size: Optional[int] = None, + weighted_loss: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + :keyword training_crop_size: Image crop size that is input to the neural network for the + training dataset. Must be a positive integer. + :paramtype training_crop_size: int + :keyword validation_crop_size: Image crop size that is input to the neural network for the + validation dataset. Must be a positive integer. + :paramtype validation_crop_size: int + :keyword validation_resize_size: Image size to which to resize before cropping for validation + dataset. Must be a positive integer. + :paramtype validation_resize_size: int + :keyword weighted_loss: Weighted loss. The accepted values are 0 for no weighted loss. + 1 for weighted loss with sqrt.(class_weights). 2 for weighted loss with class_weights. Must be + 0 or 1 or 2. + :paramtype weighted_loss: int + """ + super().__init__( + advanced_settings=advanced_settings, + ams_gradient=ams_gradient, + augmentations=augmentations, + beta1=beta1, + beta2=beta2, + checkpoint_frequency=checkpoint_frequency, + checkpoint_model=checkpoint_model, + checkpoint_run_id=checkpoint_run_id, + distributed=distributed, + early_stopping=early_stopping, + early_stopping_delay=early_stopping_delay, + early_stopping_patience=early_stopping_patience, + enable_onnx_normalization=enable_onnx_normalization, + evaluation_frequency=evaluation_frequency, + gradient_accumulation_step=gradient_accumulation_step, + layers_to_freeze=layers_to_freeze, + learning_rate=learning_rate, + learning_rate_scheduler=learning_rate_scheduler, + model_name=model_name, + momentum=momentum, + nesterov=nesterov, + number_of_epochs=number_of_epochs, + number_of_workers=number_of_workers, + optimizer=optimizer, + random_seed=random_seed, + step_lr_gamma=step_lr_gamma, + step_lr_step_size=step_lr_step_size, + training_batch_size=training_batch_size, + validation_batch_size=validation_batch_size, + warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, + warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, + weight_decay=weight_decay, + **kwargs + ) + self.training_crop_size = training_crop_size + self.validation_crop_size = validation_crop_size + self.validation_resize_size = validation_resize_size + self.weighted_loss = weighted_loss + + +class ImageModelSettingsObjectDetection(ImageModelSettings): # pylint: disable=too-many-instance-attributes + """Settings used for training the model. + For more information on the available settings please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + + :ivar advanced_settings: Settings for advanced scenarios. + :vartype advanced_settings: str + :ivar ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :vartype ams_gradient: bool + :ivar augmentations: Settings for using Augmentations. + :vartype augmentations: str + :ivar beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta1: float + :ivar beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the range + [0, 1]. + :vartype beta2: float + :ivar checkpoint_frequency: Frequency to store model checkpoints. Must be a positive integer. + :vartype checkpoint_frequency: int + :ivar checkpoint_model: The pretrained checkpoint model for incremental training. + :vartype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :ivar checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :vartype checkpoint_run_id: str + :ivar distributed: Whether to use distributed training. + :vartype distributed: bool + :ivar early_stopping: Enable early stopping logic during training. + :vartype early_stopping: bool + :ivar early_stopping_delay: Minimum number of epochs or validation evaluations to wait before + primary metric improvement + is tracked for early stopping. Must be a positive integer. + :vartype early_stopping_delay: int + :ivar early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :vartype early_stopping_patience: int + :ivar enable_onnx_normalization: Enable normalization when exporting ONNX model. + :vartype enable_onnx_normalization: bool + :ivar evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. Must + be a positive integer. + :vartype evaluation_frequency: int + :ivar gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :vartype gradient_accumulation_step: int + :ivar layers_to_freeze: Number of layers to freeze for the model. Must be a positive integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype layers_to_freeze: int + :ivar learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :vartype learning_rate: float + :ivar learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :vartype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :ivar model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :vartype model_name: str + :ivar momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, 1]. + :vartype momentum: float + :ivar nesterov: Enable nesterov when optimizer is 'sgd'. + :vartype nesterov: bool + :ivar number_of_epochs: Number of training epochs. Must be a positive integer. + :vartype number_of_epochs: int + :ivar number_of_workers: Number of data loader workers. Must be a non-negative integer. + :vartype number_of_workers: int + :ivar optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :vartype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :ivar random_seed: Random seed to be used when using deterministic training. + :vartype random_seed: int + :ivar step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float in + the range [0, 1]. + :vartype step_lr_gamma: float + :ivar step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be a + positive integer. + :vartype step_lr_step_size: int + :ivar training_batch_size: Training batch size. Must be a positive integer. + :vartype training_batch_size: int + :ivar validation_batch_size: Validation batch size. Must be a positive integer. + :vartype validation_batch_size: int + :ivar warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :vartype warmup_cosine_lr_cycles: float + :ivar warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :vartype warmup_cosine_lr_warmup_epochs: int + :ivar weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must be + a float in the range[0, 1]. + :vartype weight_decay: float + :ivar box_detections_per_image: Maximum number of detections per image, for all classes. Must + be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype box_detections_per_image: int + :ivar box_score_threshold: During inference, only return proposals with a classification score + greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :vartype box_score_threshold: float + :ivar image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype image_size: int + :ivar max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype max_size: int + :ivar min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype min_size: int + :ivar model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. Known values are: "None", + "Small", "Medium", "Large", and "ExtraLarge". + :vartype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize + :ivar multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :vartype multi_scale: bool + :ivar nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be a + float in the range [0, 1]. + :vartype nms_iou_threshold: float + :ivar tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must not + be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_grid_size: str + :ivar tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be float + in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_overlap_ratio: float + :ivar tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + :vartype tile_predictions_nms_threshold: float + :ivar validation_iou_threshold: IOU threshold to use when computing validation metric. Must be + float in the range [0, 1]. + :vartype validation_iou_threshold: float + :ivar validation_metric_type: Metric computation method to use for validation metrics. Known + values are: "None", "Coco", "Voc", and "CocoVoc". + :vartype validation_metric_type: str or + ~azure.mgmt.machinelearningservices.models.ValidationMetricType + """ + + _attribute_map = { + "advanced_settings": {"key": "advancedSettings", "type": "str"}, + "ams_gradient": {"key": "amsGradient", "type": "bool"}, + "augmentations": {"key": "augmentations", "type": "str"}, + "beta1": {"key": "beta1", "type": "float"}, + "beta2": {"key": "beta2", "type": "float"}, + "checkpoint_frequency": {"key": "checkpointFrequency", "type": "int"}, + "checkpoint_model": {"key": "checkpointModel", "type": "MLFlowModelJobInput"}, + "checkpoint_run_id": {"key": "checkpointRunId", "type": "str"}, + "distributed": {"key": "distributed", "type": "bool"}, + "early_stopping": {"key": "earlyStopping", "type": "bool"}, + "early_stopping_delay": {"key": "earlyStoppingDelay", "type": "int"}, + "early_stopping_patience": {"key": "earlyStoppingPatience", "type": "int"}, + "enable_onnx_normalization": {"key": "enableOnnxNormalization", "type": "bool"}, + "evaluation_frequency": {"key": "evaluationFrequency", "type": "int"}, + "gradient_accumulation_step": {"key": "gradientAccumulationStep", "type": "int"}, + "layers_to_freeze": {"key": "layersToFreeze", "type": "int"}, + "learning_rate": {"key": "learningRate", "type": "float"}, + "learning_rate_scheduler": {"key": "learningRateScheduler", "type": "str"}, + "model_name": {"key": "modelName", "type": "str"}, + "momentum": {"key": "momentum", "type": "float"}, + "nesterov": {"key": "nesterov", "type": "bool"}, + "number_of_epochs": {"key": "numberOfEpochs", "type": "int"}, + "number_of_workers": {"key": "numberOfWorkers", "type": "int"}, + "optimizer": {"key": "optimizer", "type": "str"}, + "random_seed": {"key": "randomSeed", "type": "int"}, + "step_lr_gamma": {"key": "stepLRGamma", "type": "float"}, + "step_lr_step_size": {"key": "stepLRStepSize", "type": "int"}, + "training_batch_size": {"key": "trainingBatchSize", "type": "int"}, + "validation_batch_size": {"key": "validationBatchSize", "type": "int"}, + "warmup_cosine_lr_cycles": {"key": "warmupCosineLRCycles", "type": "float"}, + "warmup_cosine_lr_warmup_epochs": {"key": "warmupCosineLRWarmupEpochs", "type": "int"}, + "weight_decay": {"key": "weightDecay", "type": "float"}, + "box_detections_per_image": {"key": "boxDetectionsPerImage", "type": "int"}, + "box_score_threshold": {"key": "boxScoreThreshold", "type": "float"}, + "image_size": {"key": "imageSize", "type": "int"}, + "max_size": {"key": "maxSize", "type": "int"}, + "min_size": {"key": "minSize", "type": "int"}, + "model_size": {"key": "modelSize", "type": "str"}, + "multi_scale": {"key": "multiScale", "type": "bool"}, + "nms_iou_threshold": {"key": "nmsIouThreshold", "type": "float"}, + "tile_grid_size": {"key": "tileGridSize", "type": "str"}, + "tile_overlap_ratio": {"key": "tileOverlapRatio", "type": "float"}, + "tile_predictions_nms_threshold": {"key": "tilePredictionsNmsThreshold", "type": "float"}, + "validation_iou_threshold": {"key": "validationIouThreshold", "type": "float"}, + "validation_metric_type": {"key": "validationMetricType", "type": "str"}, + } + + def __init__( # pylint: disable=too-many-locals + self, + *, + advanced_settings: Optional[str] = None, + ams_gradient: Optional[bool] = None, + augmentations: Optional[str] = None, + beta1: Optional[float] = None, + beta2: Optional[float] = None, + checkpoint_frequency: Optional[int] = None, + checkpoint_model: Optional["_models.MLFlowModelJobInput"] = None, + checkpoint_run_id: Optional[str] = None, + distributed: Optional[bool] = None, + early_stopping: Optional[bool] = None, + early_stopping_delay: Optional[int] = None, + early_stopping_patience: Optional[int] = None, + enable_onnx_normalization: Optional[bool] = None, + evaluation_frequency: Optional[int] = None, + gradient_accumulation_step: Optional[int] = None, + layers_to_freeze: Optional[int] = None, + learning_rate: Optional[float] = None, + learning_rate_scheduler: Optional[Union[str, "_models.LearningRateScheduler"]] = None, + model_name: Optional[str] = None, + momentum: Optional[float] = None, + nesterov: Optional[bool] = None, + number_of_epochs: Optional[int] = None, + number_of_workers: Optional[int] = None, + optimizer: Optional[Union[str, "_models.StochasticOptimizer"]] = None, + random_seed: Optional[int] = None, + step_lr_gamma: Optional[float] = None, + step_lr_step_size: Optional[int] = None, + training_batch_size: Optional[int] = None, + validation_batch_size: Optional[int] = None, + warmup_cosine_lr_cycles: Optional[float] = None, + warmup_cosine_lr_warmup_epochs: Optional[int] = None, + weight_decay: Optional[float] = None, + box_detections_per_image: Optional[int] = None, + box_score_threshold: Optional[float] = None, + image_size: Optional[int] = None, + max_size: Optional[int] = None, + min_size: Optional[int] = None, + model_size: Optional[Union[str, "_models.ModelSize"]] = None, + multi_scale: Optional[bool] = None, + nms_iou_threshold: Optional[float] = None, + tile_grid_size: Optional[str] = None, + tile_overlap_ratio: Optional[float] = None, + tile_predictions_nms_threshold: Optional[float] = None, + validation_iou_threshold: Optional[float] = None, + validation_metric_type: Optional[Union[str, "_models.ValidationMetricType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword advanced_settings: Settings for advanced scenarios. + :paramtype advanced_settings: str + :keyword ams_gradient: Enable AMSGrad when optimizer is 'adam' or 'adamw'. + :paramtype ams_gradient: bool + :keyword augmentations: Settings for using Augmentations. + :paramtype augmentations: str + :keyword beta1: Value of 'beta1' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta1: float + :keyword beta2: Value of 'beta2' when optimizer is 'adam' or 'adamw'. Must be a float in the + range [0, 1]. + :paramtype beta2: float + :keyword checkpoint_frequency: Frequency to store model checkpoints. Must be a positive + integer. + :paramtype checkpoint_frequency: int + :keyword checkpoint_model: The pretrained checkpoint model for incremental training. + :paramtype checkpoint_model: ~azure.mgmt.machinelearningservices.models.MLFlowModelJobInput + :keyword checkpoint_run_id: The id of a previous run that has a pretrained checkpoint for + incremental training. + :paramtype checkpoint_run_id: str + :keyword distributed: Whether to use distributed training. + :paramtype distributed: bool + :keyword early_stopping: Enable early stopping logic during training. + :paramtype early_stopping: bool + :keyword early_stopping_delay: Minimum number of epochs or validation evaluations to wait + before primary metric improvement + is tracked for early stopping. Must be a positive integer. + :paramtype early_stopping_delay: int + :keyword early_stopping_patience: Minimum number of epochs or validation evaluations with no + primary metric improvement before + the run is stopped. Must be a positive integer. + :paramtype early_stopping_patience: int + :keyword enable_onnx_normalization: Enable normalization when exporting ONNX model. + :paramtype enable_onnx_normalization: bool + :keyword evaluation_frequency: Frequency to evaluate validation dataset to get metric scores. + Must be a positive integer. + :paramtype evaluation_frequency: int + :keyword gradient_accumulation_step: Gradient accumulation means running a configured number of + "GradAccumulationStep" steps without + updating the model weights while accumulating the gradients of those steps, and then using + the accumulated gradients to compute the weight updates. Must be a positive integer. + :paramtype gradient_accumulation_step: int + :keyword layers_to_freeze: Number of layers to freeze for the model. Must be a positive + integer. + For instance, passing 2 as value for 'seresnext' means + freezing layer0 and layer1. For a full list of models supported and details on layer freeze, + please + see: https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype layers_to_freeze: int + :keyword learning_rate: Initial learning rate. Must be a float in the range [0, 1]. + :paramtype learning_rate: float + :keyword learning_rate_scheduler: Type of learning rate scheduler. Must be 'warmup_cosine' or + 'step'. Known values are: "None", "WarmupCosine", and "Step". + :paramtype learning_rate_scheduler: str or + ~azure.mgmt.machinelearningservices.models.LearningRateScheduler + :keyword model_name: Name of the model to use for training. + For more information on the available models please visit the official documentation: + https://docs.microsoft.com/en-us/azure/machine-learning/how-to-auto-train-image-models. + :paramtype model_name: str + :keyword momentum: Value of momentum when optimizer is 'sgd'. Must be a float in the range [0, + 1]. + :paramtype momentum: float + :keyword nesterov: Enable nesterov when optimizer is 'sgd'. + :paramtype nesterov: bool + :keyword number_of_epochs: Number of training epochs. Must be a positive integer. + :paramtype number_of_epochs: int + :keyword number_of_workers: Number of data loader workers. Must be a non-negative integer. + :paramtype number_of_workers: int + :keyword optimizer: Type of optimizer. Known values are: "None", "Sgd", "Adam", and "Adamw". + :paramtype optimizer: str or ~azure.mgmt.machinelearningservices.models.StochasticOptimizer + :keyword random_seed: Random seed to be used when using deterministic training. + :paramtype random_seed: int + :keyword step_lr_gamma: Value of gamma when learning rate scheduler is 'step'. Must be a float + in the range [0, 1]. + :paramtype step_lr_gamma: float + :keyword step_lr_step_size: Value of step size when learning rate scheduler is 'step'. Must be + a positive integer. + :paramtype step_lr_step_size: int + :keyword training_batch_size: Training batch size. Must be a positive integer. + :paramtype training_batch_size: int + :keyword validation_batch_size: Validation batch size. Must be a positive integer. + :paramtype validation_batch_size: int + :keyword warmup_cosine_lr_cycles: Value of cosine cycle when learning rate scheduler is + 'warmup_cosine'. Must be a float in the range [0, 1]. + :paramtype warmup_cosine_lr_cycles: float + :keyword warmup_cosine_lr_warmup_epochs: Value of warmup epochs when learning rate scheduler is + 'warmup_cosine'. Must be a positive integer. + :paramtype warmup_cosine_lr_warmup_epochs: int + :keyword weight_decay: Value of weight decay when optimizer is 'sgd', 'adam', or 'adamw'. Must + be a float in the range[0, 1]. + :paramtype weight_decay: float + :keyword box_detections_per_image: Maximum number of detections per image, for all classes. + Must be a positive integer. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype box_detections_per_image: int + :keyword box_score_threshold: During inference, only return proposals with a classification + score greater than + BoxScoreThreshold. Must be a float in the range[0, 1]. + :paramtype box_score_threshold: float + :keyword image_size: Image size for train and validation. Must be a positive integer. + Note: The training run may get into CUDA OOM if the size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype image_size: int + :keyword max_size: Maximum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype max_size: int + :keyword min_size: Minimum size of the image to be rescaled before feeding it to the backbone. + Must be a positive integer. Note: training run may get into CUDA OOM if the size is too big. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype min_size: int + :keyword model_size: Model size. Must be 'small', 'medium', 'large', or 'xlarge'. + Note: training run may get into CUDA OOM if the model size is too big. + Note: This settings is only supported for the 'yolov5' algorithm. Known values are: "None", + "Small", "Medium", "Large", and "ExtraLarge". + :paramtype model_size: str or ~azure.mgmt.machinelearningservices.models.ModelSize + :keyword multi_scale: Enable multi-scale image by varying image size by +/- 50%. + Note: training run may get into CUDA OOM if no sufficient GPU memory. + Note: This settings is only supported for the 'yolov5' algorithm. + :paramtype multi_scale: bool + :keyword nms_iou_threshold: IOU threshold used during inference in NMS post processing. Must be + a float in the range [0, 1]. + :paramtype nms_iou_threshold: float + :keyword tile_grid_size: The grid size to use for tiling each image. Note: TileGridSize must + not be + None to enable small object detection logic. A string containing two integers in mxn format. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_grid_size: str + :keyword tile_overlap_ratio: Overlap ratio between adjacent tiles in each dimension. Must be + float in the range [0, 1). + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_overlap_ratio: float + :keyword tile_predictions_nms_threshold: The IOU threshold to use to perform NMS while merging + predictions from tiles and image. + Used in validation/ inference. Must be float in the range [0, 1]. + Note: This settings is not supported for the 'yolov5' algorithm. + :paramtype tile_predictions_nms_threshold: float + :keyword validation_iou_threshold: IOU threshold to use when computing validation metric. Must + be float in the range [0, 1]. + :paramtype validation_iou_threshold: float + :keyword validation_metric_type: Metric computation method to use for validation metrics. Known + values are: "None", "Coco", "Voc", and "CocoVoc". + :paramtype validation_metric_type: str or + ~azure.mgmt.machinelearningservices.models.ValidationMetricType + """ + super().__init__( + advanced_settings=advanced_settings, + ams_gradient=ams_gradient, + augmentations=augmentations, + beta1=beta1, + beta2=beta2, + checkpoint_frequency=checkpoint_frequency, + checkpoint_model=checkpoint_model, + checkpoint_run_id=checkpoint_run_id, + distributed=distributed, + early_stopping=early_stopping, + early_stopping_delay=early_stopping_delay, + early_stopping_patience=early_stopping_patience, + enable_onnx_normalization=enable_onnx_normalization, + evaluation_frequency=evaluation_frequency, + gradient_accumulation_step=gradient_accumulation_step, + layers_to_freeze=layers_to_freeze, + learning_rate=learning_rate, + learning_rate_scheduler=learning_rate_scheduler, + model_name=model_name, + momentum=momentum, + nesterov=nesterov, + number_of_epochs=number_of_epochs, + number_of_workers=number_of_workers, + optimizer=optimizer, + random_seed=random_seed, + step_lr_gamma=step_lr_gamma, + step_lr_step_size=step_lr_step_size, + training_batch_size=training_batch_size, + validation_batch_size=validation_batch_size, + warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, + warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, + weight_decay=weight_decay, + **kwargs + ) + self.box_detections_per_image = box_detections_per_image + self.box_score_threshold = box_score_threshold + self.image_size = image_size + self.max_size = max_size + self.min_size = min_size + self.model_size = model_size + self.multi_scale = multi_scale + self.nms_iou_threshold = nms_iou_threshold + self.tile_grid_size = tile_grid_size + self.tile_overlap_ratio = tile_overlap_ratio + self.tile_predictions_nms_threshold = tile_predictions_nms_threshold + self.validation_iou_threshold = validation_iou_threshold + self.validation_metric_type = validation_metric_type + + +class ImageObjectDetection(ImageObjectDetectionBase, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Image Object Detection. Object detection is used to identify objects in an image and locate + each object with a + bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. + + All required parameters must be populated in order to send to server. + + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar model_settings: Settings used for training the model. + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :ivar search_space: Search space for sampling different combinations of models and their + hyperparameters. + :vartype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :ivar primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + """ + + _validation = { + "task_type": {"required": True}, + "training_data": {"required": True}, + "limit_settings": {"required": True}, + } + + _attribute_map = { + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, + "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, + "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + } + + def __init__( + self, + *, + training_data: "_models.MLTableJobInput", + limit_settings: "_models.ImageLimitSettings", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + sweep_settings: Optional["_models.ImageSweepSettings"] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, + search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, + primary_metric: Optional[Union[str, "_models.ObjectDetectionPrimaryMetrics"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings + :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. + :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword model_settings: Settings used for training the model. + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection + :keyword search_space: Search space for sampling different combinations of models and their + hyperparameters. + :paramtype search_space: + list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] + :keyword primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + """ + super().__init__( + limit_settings=limit_settings, + sweep_settings=sweep_settings, + validation_data=validation_data, + validation_data_size=validation_data_size, + model_settings=model_settings, + search_space=search_space, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, + **kwargs + ) + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "ImageObjectDetection" + self.training_data = training_data + self.primary_metric = primary_metric + self.limit_settings = limit_settings + self.sweep_settings = sweep_settings + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.model_settings = model_settings + self.search_space = search_space + + +class ImageSweepSettings(_serialization.Model): + """Model sweeping and hyperparameter sweeping related settings. + + All required parameters must be populated in order to send to server. + + :ivar early_termination: Type of early termination policy. + :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :ivar sampling_algorithm: [Required] Type of the hyperparameter sampling algorithms. 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: Any + ) -> None: + """ + :keyword early_termination: Type of early termination policy. + :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy + :keyword sampling_algorithm: [Required] Type of the hyperparameter sampling algorithms. + 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 IndexColumn(_serialization.Model): + """DTO object representing index column. + + :ivar column_name: Specifies the column name. + :vartype column_name: str + :ivar data_type: Specifies the data type. Known values are: "String", "Integer", "Long", + "Float", "Double", "Binary", "Datetime", and "Boolean". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + """ + + _attribute_map = { + "column_name": {"key": "columnName", "type": "str"}, + "data_type": {"key": "dataType", "type": "str"}, + } + + def __init__( + self, + *, + column_name: Optional[str] = None, + data_type: Optional[Union[str, "_models.FeatureDataType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword column_name: Specifies the column name. + :paramtype column_name: str + :keyword data_type: Specifies the data type. Known values are: "String", "Integer", "Long", + "Float", "Double", "Binary", "Datetime", and "Boolean". + :paramtype data_type: str or ~azure.mgmt.machinelearningservices.models.FeatureDataType + """ + super().__init__(**kwargs) + self.column_name = column_name + self.data_type = data_type + + +class InferenceContainerProperties(_serialization.Model): + """InferenceContainerProperties. + + :ivar liveness_route: The route to check the liveness of the inference server container. + :vartype liveness_route: ~azure.mgmt.machinelearningservices.models.Route + :ivar readiness_route: The route to check the readiness of the inference server container. + :vartype readiness_route: ~azure.mgmt.machinelearningservices.models.Route + :ivar scoring_route: The port to send the scoring requests to, within the inference server + container. + :vartype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + """ + + _attribute_map = { + "liveness_route": {"key": "livenessRoute", "type": "Route"}, + "readiness_route": {"key": "readinessRoute", "type": "Route"}, + "scoring_route": {"key": "scoringRoute", "type": "Route"}, + } + + def __init__( + self, + *, + liveness_route: Optional["_models.Route"] = None, + readiness_route: Optional["_models.Route"] = None, + scoring_route: Optional["_models.Route"] = None, + **kwargs: Any + ) -> None: + """ + :keyword liveness_route: The route to check the liveness of the inference server container. + :paramtype liveness_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword readiness_route: The route to check the readiness of the inference server container. + :paramtype readiness_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword scoring_route: The port to send the scoring requests to, within the inference server + container. + :paramtype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + """ + super().__init__(**kwargs) + self.liveness_route = liveness_route + self.readiness_route = readiness_route + self.scoring_route = scoring_route + + +class InferenceEndpoint(TrackedResource): + """InferenceEndpoint. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.InferenceEndpointProperties + :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": "InferenceEndpointProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.InferenceEndpointProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :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.InferenceEndpointProperties + :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 PropertiesBase(_serialization.Model): + """Base definition for pool resources. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "[StringKeyValuePair]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[List["_models.StringKeyValuePair"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the resource. + :paramtype description: str + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + """ + super().__init__(**kwargs) + self.description = description + self.properties = properties + + +class InferenceEndpointProperties(PropertiesBase): + """InferenceEndpoint configuration. + + 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 server. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :ivar auth_mode: [Required] Authentication mode for the endpoint. Required. "AAD" + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.AuthMode + :ivar endpoint_uri: Endpoint URI for the inference endpoint. + :vartype endpoint_uri: str + :ivar group_name: [Required] Group within the same pool with which this endpoint needs to be + associated with. Required. + :vartype group_name: str + :ivar provisioning_state: Provisioning state for the endpoint. Known values are: "Creating", + "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PoolProvisioningState + :ivar request_configuration: RequestConfiguration for endpoint. + :vartype request_configuration: ~azure.mgmt.machinelearningservices.models.RequestConfiguration + """ + + _validation = { + "auth_mode": {"required": True}, + "endpoint_uri": {"readonly": True}, + "group_name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "[StringKeyValuePair]"}, + "auth_mode": {"key": "authMode", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "group_name": {"key": "groupName", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "request_configuration": {"key": "requestConfiguration", "type": "RequestConfiguration"}, + } + + def __init__( + self, + *, + auth_mode: Union[str, "_models.AuthMode"], + group_name: str, + description: Optional[str] = None, + properties: Optional[List["_models.StringKeyValuePair"]] = None, + request_configuration: Optional["_models.RequestConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the resource. + :paramtype description: str + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :keyword auth_mode: [Required] Authentication mode for the endpoint. Required. "AAD" + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.AuthMode + :keyword group_name: [Required] Group within the same pool with which this endpoint needs to be + associated with. Required. + :paramtype group_name: str + :keyword request_configuration: RequestConfiguration for endpoint. + :paramtype request_configuration: + ~azure.mgmt.machinelearningservices.models.RequestConfiguration + """ + super().__init__(description=description, properties=properties, **kwargs) + self.auth_mode = auth_mode + self.endpoint_uri = None + self.group_name = group_name + self.provisioning_state = None + self.request_configuration = request_configuration + + +class InferenceEndpointTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of InferenceEndpoint entities. + + :ivar next_link: The link to the next page of InferenceEndpoint objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type InferenceEndpoint. + :vartype value: list[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[InferenceEndpoint]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.InferenceEndpoint"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of InferenceEndpoint objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type InferenceEndpoint. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class InferenceGroup(TrackedResource): + """InferenceGroup. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.InferenceGroupProperties + :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": "InferenceGroupProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.InferenceGroupProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :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.InferenceGroupProperties + :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 InferenceGroupProperties(PropertiesBase): + """Inference group configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :ivar environment_configuration: Gets or sets environment configuration for the inference + group. Used if PoolType=ScaleUnit. + :vartype environment_configuration: + ~azure.mgmt.machinelearningservices.models.GroupEnvironmentConfiguration + :ivar model_configuration: Gets or sets model configuration for the inference group. Used if + PoolType=ScaleUnit. + :vartype model_configuration: + ~azure.mgmt.machinelearningservices.models.GroupModelConfiguration + :ivar node_sku_type: Gets or sets compute instance type. + :vartype node_sku_type: str + :ivar provisioning_state: Provisioning state for the inference group. Known values are: + "Creating", "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PoolProvisioningState + :ivar scale_unit_size: Gets or sets Scale Unit size. + :vartype scale_unit_size: int + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "[StringKeyValuePair]"}, + "environment_configuration": {"key": "environmentConfiguration", "type": "GroupEnvironmentConfiguration"}, + "model_configuration": {"key": "modelConfiguration", "type": "GroupModelConfiguration"}, + "node_sku_type": {"key": "nodeSkuType", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "scale_unit_size": {"key": "scaleUnitSize", "type": "int"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[List["_models.StringKeyValuePair"]] = None, + environment_configuration: Optional["_models.GroupEnvironmentConfiguration"] = None, + model_configuration: Optional["_models.GroupModelConfiguration"] = None, + node_sku_type: Optional[str] = None, + scale_unit_size: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the resource. + :paramtype description: str + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :keyword environment_configuration: Gets or sets environment configuration for the inference + group. Used if PoolType=ScaleUnit. + :paramtype environment_configuration: + ~azure.mgmt.machinelearningservices.models.GroupEnvironmentConfiguration + :keyword model_configuration: Gets or sets model configuration for the inference group. Used if + PoolType=ScaleUnit. + :paramtype model_configuration: + ~azure.mgmt.machinelearningservices.models.GroupModelConfiguration + :keyword node_sku_type: Gets or sets compute instance type. + :paramtype node_sku_type: str + :keyword scale_unit_size: Gets or sets Scale Unit size. + :paramtype scale_unit_size: int + """ + super().__init__(description=description, properties=properties, **kwargs) + self.environment_configuration = environment_configuration + self.model_configuration = model_configuration + self.node_sku_type = node_sku_type + self.provisioning_state = None + self.scale_unit_size = scale_unit_size + + +class InferenceGroupTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of InferenceGroup entities. + + :ivar next_link: The link to the next page of InferenceGroup objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type InferenceGroup. + :vartype value: list[~azure.mgmt.machinelearningservices.models.InferenceGroup] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[InferenceGroup]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.InferenceGroup"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of InferenceGroup objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type InferenceGroup. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.InferenceGroup] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class InferencePool(TrackedResource): + """InferencePool. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.InferencePoolProperties + :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": "InferencePoolProperties"}, + "sku": {"key": "sku", "type": "Sku"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.InferencePoolProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :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.InferencePoolProperties + :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 InferencePoolProperties(PropertiesBase): + """Inference pool configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar description: Description of the resource. + :vartype description: str + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :ivar provisioning_state: Provisioning state for the pool. Known values are: "Creating", + "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PoolProvisioningState + :ivar scale_unit_configuration: Gets or sets ScaleUnitConfiguration for the inference pool. + Used if PoolType=ScaleUnit. + :vartype scale_unit_configuration: + ~azure.mgmt.machinelearningservices.models.ScaleUnitConfiguration + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "[StringKeyValuePair]"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "scale_unit_configuration": {"key": "scaleUnitConfiguration", "type": "ScaleUnitConfiguration"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[List["_models.StringKeyValuePair"]] = None, + scale_unit_configuration: Optional["_models.ScaleUnitConfiguration"] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description of the resource. + :paramtype description: str + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: list[~azure.mgmt.machinelearningservices.models.StringKeyValuePair] + :keyword scale_unit_configuration: Gets or sets ScaleUnitConfiguration for the inference pool. + Used if PoolType=ScaleUnit. + :paramtype scale_unit_configuration: + ~azure.mgmt.machinelearningservices.models.ScaleUnitConfiguration + """ + super().__init__(description=description, properties=properties, **kwargs) + self.provisioning_state = None + self.scale_unit_configuration = scale_unit_configuration + + +class InferencePoolTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of InferencePool entities. + + :ivar next_link: The link to the next page of InferencePool objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type InferencePool. + :vartype value: list[~azure.mgmt.machinelearningservices.models.InferencePool] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[InferencePool]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.InferencePool"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of InferencePool objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type InferencePool. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.InferencePool] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class InstanceTypeSchema(_serialization.Model): + """Instance type schema. + + :ivar node_selector: Node Selector. + :vartype node_selector: dict[str, str] + :ivar resources: Resource requests/limits for this instance type. + :vartype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + """ + + _attribute_map = { + "node_selector": {"key": "nodeSelector", "type": "{str}"}, + "resources": {"key": "resources", "type": "InstanceTypeSchemaResources"}, + } + + def __init__( + self, + *, + node_selector: Optional[Dict[str, str]] = None, + resources: Optional["_models.InstanceTypeSchemaResources"] = None, + **kwargs: Any + ) -> None: + """ + :keyword node_selector: Node Selector. + :paramtype node_selector: dict[str, str] + :keyword resources: Resource requests/limits for this instance type. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + """ + super().__init__(**kwargs) + self.node_selector = node_selector + self.resources = resources + + +class InstanceTypeSchemaResources(_serialization.Model): + """Resource requests/limits for this instance type. + + :ivar requests: Resource requests for this instance type. + :vartype requests: dict[str, str] + :ivar limits: Resource limits for this instance type. + :vartype limits: dict[str, str] + """ + + _attribute_map = { + "requests": {"key": "requests", "type": "{str}"}, + "limits": {"key": "limits", "type": "{str}"}, + } + + def __init__( + self, *, requests: Optional[Dict[str, str]] = None, limits: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword requests: Resource requests for this instance type. + :paramtype requests: dict[str, str] + :keyword limits: Resource limits for this instance type. + :paramtype limits: dict[str, str] + """ + super().__init__(**kwargs) + self.requests = requests + self.limits = limits + + +class IPRule(_serialization.Model): + """Contains an IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) or + '124.56.78.0/24' (all addresses that start with 124.56.78). Value could be 'Allow' or 'Deny'. + + :ivar value: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP address) + or '124.56.78.0/24' (all addresses that start with 124.56.78). Value could be 'Allow' or + 'Deny'. + :vartype value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple IP + address) or '124.56.78.0/24' (all addresses that start with 124.56.78). Value could be 'Allow' + or 'Deny'. + :paramtype value: str + """ + super().__init__(**kwargs) + self.value = value + + +class JobBase(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.JobBaseProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "JobBaseProperties"}, + } + + def __init__(self, *, properties: "_models.JobBaseProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class JobBaseResourceArmPaginatedResult(_serialization.Model): + """A paginated list of JobBase entities. + + :ivar next_link: The link to the next page of JobBase objects. If null, there are no additional + pages. + :vartype next_link: str + :ivar value: An array of objects of type JobBase. + :vartype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[JobBase]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.JobBase"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of JobBase objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type JobBase. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class JobResourceConfiguration(ResourceConfiguration): + """JobResourceConfiguration. + + :ivar instance_count: Optional number of instances or nodes used by the compute target. + :vartype instance_count: int + :ivar instance_type: Optional type of VM used as supported by the compute target. + :vartype instance_type: str + :ivar properties: Additional properties bag. + :vartype properties: dict[str, JSON] + :ivar docker_args: Extra arguments to pass to the Docker run command. This would override any + parameters that have already been set by the system, or in this section. This parameter is only + supported for Azure ML compute types. + :vartype docker_args: str + :ivar shm_size: Size of the docker container's shared memory block. This should be in the + format of (number)(unit) where number as to be greater than 0 and the unit can be one of + b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). + :vartype shm_size: str + """ + + _validation = { + "shm_size": {"pattern": r"\d+[bBkKmMgG]"}, + } + + _attribute_map = { + "instance_count": {"key": "instanceCount", "type": "int"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "properties": {"key": "properties", "type": "{object}"}, + "docker_args": {"key": "dockerArgs", "type": "str"}, + "shm_size": {"key": "shmSize", "type": "str"}, + } + + def __init__( + self, + *, + instance_count: int = 1, + instance_type: Optional[str] = None, + properties: Optional[Dict[str, JSON]] = None, + docker_args: Optional[str] = None, + shm_size: str = "2g", + **kwargs: Any + ) -> None: + """ + :keyword instance_count: Optional number of instances or nodes used by the compute target. + :paramtype instance_count: int + :keyword instance_type: Optional type of VM used as supported by the compute target. + :paramtype instance_type: str + :keyword properties: Additional properties bag. + :paramtype properties: dict[str, JSON] + :keyword docker_args: Extra arguments to pass to the Docker run command. This would override + any parameters that have already been set by the system, or in this section. This parameter is + only supported for Azure ML compute types. + :paramtype docker_args: str + :keyword shm_size: Size of the docker container's shared memory block. This should be in the + format of (number)(unit) where number as to be greater than 0 and the unit can be one of + b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). + :paramtype shm_size: str + """ + super().__init__(instance_count=instance_count, instance_type=instance_type, properties=properties, **kwargs) + self.docker_args = docker_args + self.shm_size = shm_size + + +class JobResources(_serialization.Model): + """JobResources. + + :ivar instance_types: List of instance types to choose from. + :vartype instance_types: list[str] + """ + + _attribute_map = { + "instance_types": {"key": "instanceTypes", "type": "[str]"}, + } + + def __init__(self, *, instance_types: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword instance_types: List of instance types to choose from. + :paramtype instance_types: list[str] + """ + super().__init__(**kwargs) + self.instance_types = instance_types + + +class JobScheduleAction(ScheduleActionBase): + """JobScheduleAction. + + All required parameters must be populated in order to send to server. + + :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values + are: "CreateJob", "InvokeBatchEndpoint", and "CreateMonitor". + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType + :ivar job_definition: [Required] Defines Schedule action definition details. Required. + :vartype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + + _validation = { + "action_type": {"required": True}, + "job_definition": {"required": True}, + } + + _attribute_map = { + "action_type": {"key": "actionType", "type": "str"}, + "job_definition": {"key": "jobDefinition", "type": "JobBaseProperties"}, + } + + def __init__(self, *, job_definition: "_models.JobBaseProperties", **kwargs: Any) -> None: + """ + :keyword job_definition: [Required] Defines Schedule action definition details. Required. + :paramtype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + """ + super().__init__(**kwargs) + self.action_type: str = "CreateJob" + self.job_definition = job_definition + + +class JobService(_serialization.Model): + """Job endpoint definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar endpoint: Url for endpoint. + :vartype endpoint: str + :ivar error_message: Any error in the service. + :vartype error_message: str + :ivar job_service_type: Endpoint type. + :vartype job_service_type: str + :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. + :vartype port: int + :ivar properties: Additional properties to set on the endpoint. + :vartype properties: dict[str, str] + :ivar status: Status of endpoint. + :vartype status: str + """ + + _validation = { + "error_message": {"readonly": True}, + "status": {"readonly": True}, + } + + _attribute_map = { + "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"}, + } + + def __init__( + self, + *, + 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: Any + ) -> None: + """ + :keyword endpoint: Url for endpoint. + :paramtype endpoint: str + :keyword job_service_type: Endpoint type. + :paramtype job_service_type: str + :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. + :paramtype port: int + :keyword properties: Additional properties to set on the endpoint. + :paramtype properties: dict[str, str] + """ + super().__init__(**kwargs) + 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 JupyterKernelConfig(_serialization.Model): + """Jupyter kernel configuration. + + :ivar argv: Argument to the the runtime. + :vartype argv: list[str] + :ivar display_name: Display name of the kernel. + :vartype display_name: str + :ivar language: Language of the kernel [Example value: python]. + :vartype language: str + """ + + _attribute_map = { + "argv": {"key": "argv", "type": "[str]"}, + "display_name": {"key": "displayName", "type": "str"}, + "language": {"key": "language", "type": "str"}, + } + + def __init__( + self, + *, + argv: Optional[List[str]] = None, + display_name: Optional[str] = None, + language: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword argv: Argument to the the runtime. + :paramtype argv: list[str] + :keyword display_name: Display name of the kernel. + :paramtype display_name: str + :keyword language: Language of the kernel [Example value: python]. + :paramtype language: str + """ + super().__init__(**kwargs) + self.argv = argv + self.display_name = display_name + self.language = language + + +class KeyVaultProperties(_serialization.Model): + """Customer Key vault properties. + + All required parameters must be populated in order to send to server. + + :ivar identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :vartype identity_client_id: str + :ivar key_identifier: KeyVault key identifier to encrypt the data. Required. + :vartype key_identifier: str + :ivar key_vault_arm_id: KeyVault Arm Id that contains the data encryption key. Required. + :vartype key_vault_arm_id: str + """ + + _validation = { + "key_identifier": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "key_vault_arm_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "identity_client_id": {"key": "identityClientId", "type": "str"}, + "key_identifier": {"key": "keyIdentifier", "type": "str"}, + "key_vault_arm_id": {"key": "keyVaultArmId", "type": "str"}, + } + + def __init__( + self, *, key_identifier: str, key_vault_arm_id: str, identity_client_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword identity_client_id: Currently, we support only SystemAssigned MSI. + We need this when we support UserAssignedIdentities. + :paramtype identity_client_id: str + :keyword key_identifier: KeyVault key identifier to encrypt the data. Required. + :paramtype key_identifier: str + :keyword key_vault_arm_id: KeyVault Arm Id that contains the data encryption key. Required. + :paramtype key_vault_arm_id: str + """ + super().__init__(**kwargs) + self.identity_client_id = identity_client_id + self.key_identifier = key_identifier + self.key_vault_arm_id = key_vault_arm_id + + +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: Any) -> None: + """ + :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 server. + + :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 + :ivar compute_location: Location for the underlying 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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar description: The description of the Machine Learning compute. + :vartype description: str + :ivar created_on: The time at which the compute was created. + :vartype created_on: ~datetime.datetime + :ivar modified_on: The time at which the compute was last modified. + :vartype modified_on: ~datetime.datetime + :ivar resource_id: ARM resource id of the underlying compute. + :vartype resource_id: str + :ivar provisioning_errors: Errors during provisioning. + :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought + from outside if true, or machine learning service provisioned it if false. + :vartype is_attached_compute: bool + :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI + and AAD exclusively for authentication. + :vartype disable_local_auth: bool + """ + + _validation = { + "compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + "created_on": {"readonly": True}, + "modified_on": {"readonly": True}, + "provisioning_errors": {"readonly": True}, + "is_attached_compute": {"readonly": True}, + } + + _attribute_map = { + "properties": {"key": "properties", "type": "KubernetesProperties"}, + "compute_type": {"key": "computeType", "type": "str"}, + "compute_location": {"key": "computeLocation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "created_on": {"key": "createdOn", "type": "iso-8601"}, + "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, + "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, + "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + } + + def __init__( + self, + *, + properties: Optional["_models.KubernetesProperties"] = None, + compute_location: Optional[str] = None, + description: Optional[str] = None, + resource_id: Optional[str] = None, + disable_local_auth: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: Properties of Kubernetes. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :keyword compute_location: Location for the underlying compute. + :paramtype compute_location: str + :keyword description: The description of the Machine Learning compute. + :paramtype description: str + :keyword resource_id: ARM resource id of the underlying compute. + :paramtype resource_id: str + :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only + MSI and AAD exclusively for authentication. + :paramtype disable_local_auth: bool + """ + super().__init__( + compute_location=compute_location, + description=description, + resource_id=resource_id, + disable_local_auth=disable_local_auth, + properties=properties, + **kwargs + ) + self.properties = properties + self.compute_type: str = "Kubernetes" + self.compute_location = compute_location + self.provisioning_state = None + self.description = description + self.created_on = None + self.modified_on = None + self.resource_id = resource_id + self.provisioning_errors = None + self.is_attached_compute = None + self.disable_local_auth = disable_local_auth + + +class OnlineDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: disable=too-many-instance-attributes + """OnlineDeploymentProperties. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + KubernetesOnlineDeployment, ManagedOnlineDeployment + + 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 server. + + :ivar code_configuration: Code configuration for the endpoint deployment. + :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. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known + values are: "Managed", "Kubernetes", and "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: + "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + + _validation = { + "endpoint_compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + "description": {"key": "description", "type": "str"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "properties": {"key": "properties", "type": "{str}"}, + "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, + "data_collector": {"key": "dataCollector", "type": "DataCollector"}, + "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, + "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, + "model": {"key": "model", "type": "str"}, + "model_mount_path": {"key": "modelMountPath", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, + "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, + "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, + } + + _subtype_map = { + "endpoint_compute_type": {"Kubernetes": "KubernetesOnlineDeployment", "Managed": "ManagedOnlineDeployment"} + } + + def __init__( + self, + *, + code_configuration: Optional["_models.CodeConfiguration"] = None, + description: Optional[str] = None, + environment_id: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + app_insights_enabled: bool = False, + data_collector: Optional["_models.DataCollector"] = None, + egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, + instance_type: Optional[str] = None, + liveness_probe: Optional["_models.ProbeSettings"] = None, + model: Optional[str] = None, + model_mount_path: Optional[str] = None, + readiness_probe: Optional["_models.ProbeSettings"] = None, + request_settings: Optional["_models.OnlineRequestSettings"] = None, + scale_settings: Optional["_models.OnlineScaleSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword code_configuration: Code configuration for the endpoint deployment. + :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. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + super().__init__( + code_configuration=code_configuration, + description=description, + environment_id=environment_id, + environment_variables=environment_variables, + properties=properties, + **kwargs + ) + self.app_insights_enabled = app_insights_enabled + self.data_collector = data_collector + self.egress_public_network_access = egress_public_network_access + self.endpoint_compute_type: Optional[str] = None + self.instance_type = instance_type + self.liveness_probe = liveness_probe + self.model = model + self.model_mount_path = model_mount_path + self.provisioning_state = None + self.readiness_probe = readiness_probe + self.request_settings = request_settings + self.scale_settings = scale_settings + + +class KubernetesOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=too-many-instance-attributes + """Properties specific to a KubernetesOnlineDeployment. + + 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 server. + + :ivar code_configuration: Code configuration for the endpoint deployment. + :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. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known + values are: "Managed", "Kubernetes", and "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: + "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :ivar container_resource_requirements: The resource requirements for the container (cpu and + memory). + :vartype container_resource_requirements: + ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + """ + + _validation = { + "endpoint_compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + "description": {"key": "description", "type": "str"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "properties": {"key": "properties", "type": "{str}"}, + "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, + "data_collector": {"key": "dataCollector", "type": "DataCollector"}, + "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, + "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, + "model": {"key": "model", "type": "str"}, + "model_mount_path": {"key": "modelMountPath", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, + "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, + "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, + "container_resource_requirements": { + "key": "containerResourceRequirements", + "type": "ContainerResourceRequirements", + }, + } + + def __init__( + self, + *, + code_configuration: Optional["_models.CodeConfiguration"] = None, + description: Optional[str] = None, + environment_id: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + app_insights_enabled: bool = False, + data_collector: Optional["_models.DataCollector"] = None, + egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, + instance_type: Optional[str] = None, + liveness_probe: Optional["_models.ProbeSettings"] = None, + model: Optional[str] = None, + model_mount_path: Optional[str] = None, + readiness_probe: Optional["_models.ProbeSettings"] = None, + request_settings: Optional["_models.OnlineRequestSettings"] = None, + scale_settings: Optional["_models.OnlineScaleSettings"] = None, + container_resource_requirements: Optional["_models.ContainerResourceRequirements"] = None, + **kwargs: Any + ) -> None: + """ + :keyword code_configuration: Code configuration for the endpoint deployment. + :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. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :keyword container_resource_requirements: The resource requirements for the container (cpu and + memory). + :paramtype container_resource_requirements: + ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + """ + super().__init__( + code_configuration=code_configuration, + description=description, + environment_id=environment_id, + environment_variables=environment_variables, + properties=properties, + app_insights_enabled=app_insights_enabled, + data_collector=data_collector, + egress_public_network_access=egress_public_network_access, + instance_type=instance_type, + liveness_probe=liveness_probe, + model=model, + model_mount_path=model_mount_path, + readiness_probe=readiness_probe, + request_settings=request_settings, + scale_settings=scale_settings, + **kwargs + ) + self.endpoint_compute_type: str = "Kubernetes" + self.container_resource_requirements = container_resource_requirements + + +class KubernetesProperties(_serialization.Model): + """Kubernetes properties. + + :ivar relay_connection_string: Relay connection string. + :vartype relay_connection_string: str + :ivar service_bus_connection_string: ServiceBus connection string. + :vartype service_bus_connection_string: str + :ivar extension_principal_id: Extension principal-id. + :vartype extension_principal_id: str + :ivar extension_instance_release_train: Extension instance release train. + :vartype extension_instance_release_train: str + :ivar vc_name: VC name. + :vartype vc_name: str + :ivar namespace: Compute namespace. + :vartype namespace: str + :ivar default_instance_type: Default instance type. + :vartype default_instance_type: str + :ivar instance_types: Instance Type Schema. + :vartype instance_types: dict[str, + ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + """ + + _attribute_map = { + "relay_connection_string": {"key": "relayConnectionString", "type": "str"}, + "service_bus_connection_string": {"key": "serviceBusConnectionString", "type": "str"}, + "extension_principal_id": {"key": "extensionPrincipalId", "type": "str"}, + "extension_instance_release_train": {"key": "extensionInstanceReleaseTrain", "type": "str"}, + "vc_name": {"key": "vcName", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "default_instance_type": {"key": "defaultInstanceType", "type": "str"}, + "instance_types": {"key": "instanceTypes", "type": "{InstanceTypeSchema}"}, + } + + def __init__( + self, + *, + relay_connection_string: Optional[str] = None, + service_bus_connection_string: Optional[str] = None, + extension_principal_id: Optional[str] = None, + extension_instance_release_train: Optional[str] = None, + vc_name: Optional[str] = None, + namespace: str = "default", + default_instance_type: Optional[str] = None, + instance_types: Optional[Dict[str, "_models.InstanceTypeSchema"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword relay_connection_string: Relay connection string. + :paramtype relay_connection_string: str + :keyword service_bus_connection_string: ServiceBus connection string. + :paramtype service_bus_connection_string: str + :keyword extension_principal_id: Extension principal-id. + :paramtype extension_principal_id: str + :keyword extension_instance_release_train: Extension instance release train. + :paramtype extension_instance_release_train: str + :keyword vc_name: VC name. + :paramtype vc_name: str + :keyword namespace: Compute namespace. + :paramtype namespace: str + :keyword default_instance_type: Default instance type. + :paramtype default_instance_type: str + :keyword instance_types: Instance Type Schema. + :paramtype instance_types: dict[str, + ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + """ + super().__init__(**kwargs) + self.relay_connection_string = relay_connection_string + self.service_bus_connection_string = service_bus_connection_string + self.extension_principal_id = extension_principal_id + self.extension_instance_release_train = extension_instance_release_train + self.vc_name = vc_name + self.namespace = namespace + self.default_instance_type = default_instance_type + self.instance_types = instance_types + + +class OneLakeArtifact(_serialization.Model): + """OneLake artifact (data source) configuration. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + LakeHouseArtifact + + All required parameters must be populated in order to send to server. + + :ivar artifact_name: [Required] OneLake artifact name. Required. + :vartype artifact_name: str + :ivar artifact_type: [Required] OneLake artifact type. Required. "LakeHouse" + :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType + """ + + _validation = { + "artifact_name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "artifact_type": {"required": True}, + } + + _attribute_map = { + "artifact_name": {"key": "artifactName", "type": "str"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + } + + _subtype_map = {"artifact_type": {"LakeHouse": "LakeHouseArtifact"}} + + def __init__(self, *, artifact_name: str, **kwargs: Any) -> None: + """ + :keyword artifact_name: [Required] OneLake artifact name. Required. + :paramtype artifact_name: str + """ + super().__init__(**kwargs) + self.artifact_name = artifact_name + self.artifact_type: Optional[str] = None + + +class LakeHouseArtifact(OneLakeArtifact): + """LakeHouseArtifact. + + All required parameters must be populated in order to send to server. + + :ivar artifact_name: [Required] OneLake artifact name. Required. + :vartype artifact_name: str + :ivar artifact_type: [Required] OneLake artifact type. Required. "LakeHouse" + :vartype artifact_type: str or ~azure.mgmt.machinelearningservices.models.OneLakeArtifactType + """ + + _validation = { + "artifact_name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "artifact_type": {"required": True}, + } + + _attribute_map = { + "artifact_name": {"key": "artifactName", "type": "str"}, + "artifact_type": {"key": "artifactType", "type": "str"}, + } + + def __init__(self, *, artifact_name: str, **kwargs: Any) -> None: + """ + :keyword artifact_name: [Required] OneLake artifact name. Required. + :paramtype artifact_name: str + """ + super().__init__(artifact_name=artifact_name, **kwargs) + self.artifact_type: str = "LakeHouse" + + +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: Any) -> None: + """ """ + 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: The primary access key of the Notebook. + :vartype primary_access_key: str + :ivar secondary_access_key: The secondary access key of the Notebook. + :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: Any) -> None: + """ """ + 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: The access key of the storage. + :vartype user_storage_key: str + """ + + _validation = { + "user_storage_key": {"readonly": True}, + } + + _attribute_map = { + "user_storage_key": {"key": "userStorageKey", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + 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"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class ListWorkspaceKeysResult(_serialization.Model): + """ListWorkspaceKeysResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar app_insights_instrumentation_key: The access key of the workspace app insights. + :vartype app_insights_instrumentation_key: str + :ivar container_registry_credentials: + :vartype container_registry_credentials: + ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult + :ivar notebook_access_keys: + :vartype notebook_access_keys: + ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + :ivar user_storage_arm_id: The arm Id key of the workspace storage. + :vartype user_storage_arm_id: str + :ivar user_storage_key: The access key of the workspace storage. + :vartype user_storage_key: str + """ + + _validation = { + "app_insights_instrumentation_key": {"readonly": True}, + "user_storage_arm_id": {"readonly": True}, + "user_storage_key": {"readonly": True}, + } + + _attribute_map = { + "app_insights_instrumentation_key": {"key": "appInsightsInstrumentationKey", "type": "str"}, + "container_registry_credentials": { + "key": "containerRegistryCredentials", + "type": "RegistryListCredentialsResult", + }, + "notebook_access_keys": {"key": "notebookAccessKeys", "type": "ListNotebookKeysResult"}, + "user_storage_arm_id": {"key": "userStorageArmId", "type": "str"}, + "user_storage_key": {"key": "userStorageKey", "type": "str"}, + } + + def __init__( + self, + *, + container_registry_credentials: Optional["_models.RegistryListCredentialsResult"] = None, + notebook_access_keys: Optional["_models.ListNotebookKeysResult"] = None, + **kwargs: Any + ) -> None: + """ + :keyword container_registry_credentials: + :paramtype container_registry_credentials: + ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult + :keyword notebook_access_keys: + :paramtype notebook_access_keys: + ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + """ + super().__init__(**kwargs) + self.app_insights_instrumentation_key = None + self.container_registry_credentials = container_registry_credentials + self.notebook_access_keys = notebook_access_keys + self.user_storage_arm_id = None + self.user_storage_key = None + + +class ListWorkspaceQuotas(_serialization.Model): + """The List WorkspaceQuotasByVMFamily operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Workspace Quotas by VM Family. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ResourceQuota] + :ivar next_link: The URI to fetch the next page of workspace quota information by VM Family. + Call ListNext() with this to fetch the next page of Workspace Quota information. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceQuota]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + +class LiteralJobInput(JobInput): + """Literal input type. + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar value: [Required] Literal value for the input. Required. + :vartype value: str + """ + + _validation = { + "job_input_type": {"required": True}, + "value": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, value: str, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword description: Description for the input. + :paramtype description: str + :keyword value: [Required] Literal value for the input. Required. + :paramtype value: str + """ + super().__init__(description=description, **kwargs) + self.job_input_type: str = "literal" + self.value = value + + +class ManagedComputeIdentity(MonitorComputeIdentityBase): + """Managed compute identity definition. + + All required parameters must be populated in order to send to server. + + :ivar compute_identity_type: [Required] Specifies the type of identity to use within the + monitoring jobs. Required. Known values are: "AmlToken" and "ManagedIdentity". + :vartype compute_identity_type: str or + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityType + :ivar identity: The identity which will be leveraged by the monitoring jobs. + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + """ + + _validation = { + "compute_identity_type": {"required": True}, + } + + _attribute_map = { + "compute_identity_type": {"key": "computeIdentityType", "type": "str"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + } + + def __init__(self, *, identity: Optional["_models.ManagedServiceIdentity"] = None, **kwargs: Any) -> None: + """ + :keyword identity: The identity which will be leveraged by the monitoring jobs. + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + """ + super().__init__(**kwargs) + self.compute_identity_type: str = "ManagedIdentity" + self.identity = identity + + +class ManagedIdentity(IdentityConfiguration): + """Managed identity configuration. + + All required parameters must be populated in order to send to server. + + :ivar identity_type: [Required] Specifies the type of identity framework. Required. Known + values are: "Managed", "AMLToken", and "UserIdentity". + :vartype identity_type: str or + ~azure.mgmt.machinelearningservices.models.IdentityConfigurationType + :ivar client_id: Specifies a user-assigned identity by client ID. For system-assigned, do not + set this field. + :vartype client_id: str + :ivar object_id: Specifies a user-assigned identity by object ID. For system-assigned, do not + set this field. + :vartype object_id: str + :ivar resource_id: Specifies a user-assigned identity by ARM resource ID. For system-assigned, + do not set this field. + :vartype resource_id: str + """ + + _validation = { + "identity_type": {"required": True}, + } + + _attribute_map = { + "identity_type": {"key": "identityType", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "object_id": {"key": "objectId", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + object_id: Optional[str] = None, + resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 ManagedIdentityAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """ManagedIdentityAuthTypeWorkspaceConnectionProperties. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionManagedIdentity"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionManagedIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ManagedIdentity" + self.credentials = credentials + + +class ManagedIdentityCredential(DataReferenceCredential): + """Credential for user managed identity. + + All required parameters must be populated in order to send to server. + + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "SAS", "DockerCredentials", "ManagedIdentity", and "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + :ivar managed_identity_type: ManagedIdentityCredential identity type. + :vartype managed_identity_type: str + :ivar user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_client_id: str + :ivar user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_principal_id: str + :ivar user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_resource_id: str + :ivar user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :vartype user_managed_identity_tenant_id: str + """ + + _validation = { + "credential_type": {"required": True}, + } + + _attribute_map = { + "credential_type": {"key": "credentialType", "type": "str"}, + "managed_identity_type": {"key": "managedIdentityType", "type": "str"}, + "user_managed_identity_client_id": {"key": "userManagedIdentityClientId", "type": "str"}, + "user_managed_identity_principal_id": {"key": "userManagedIdentityPrincipalId", "type": "str"}, + "user_managed_identity_resource_id": {"key": "userManagedIdentityResourceId", "type": "str"}, + "user_managed_identity_tenant_id": {"key": "userManagedIdentityTenantId", "type": "str"}, + } + + def __init__( + self, + *, + managed_identity_type: Optional[str] = None, + user_managed_identity_client_id: Optional[str] = None, + user_managed_identity_principal_id: Optional[str] = None, + user_managed_identity_resource_id: Optional[str] = None, + user_managed_identity_tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword managed_identity_type: ManagedIdentityCredential identity type. + :paramtype managed_identity_type: str + :keyword user_managed_identity_client_id: ClientId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :paramtype user_managed_identity_client_id: str + :keyword user_managed_identity_principal_id: PrincipalId for the UAMI. For ManagedIdentityType + = SystemManaged, this field is null. + :paramtype user_managed_identity_principal_id: str + :keyword user_managed_identity_resource_id: Full arm scope for the Id. For ManagedIdentityType + = SystemManaged, this field is null. + :paramtype user_managed_identity_resource_id: str + :keyword user_managed_identity_tenant_id: TenantId for the UAMI. For ManagedIdentityType = + SystemManaged, this field is null. + :paramtype user_managed_identity_tenant_id: str + """ + super().__init__(**kwargs) + self.credential_type: str = "ManagedIdentity" + self.managed_identity_type = managed_identity_type + self.user_managed_identity_client_id = user_managed_identity_client_id + self.user_managed_identity_principal_id = user_managed_identity_principal_id + self.user_managed_identity_resource_id = user_managed_identity_resource_id + self.user_managed_identity_tenant_id = user_managed_identity_tenant_id + + +class ManagedNetworkProvisionOptions(_serialization.Model): + """Managed Network Provisioning options for managed network of a machine learning workspace. + + :ivar include_spark: + :vartype include_spark: bool + """ + + _attribute_map = { + "include_spark": {"key": "includeSpark", "type": "bool"}, + } + + def __init__(self, *, include_spark: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword include_spark: + :paramtype include_spark: bool + """ + super().__init__(**kwargs) + self.include_spark = include_spark + + +class ManagedNetworkProvisionStatus(_serialization.Model): + """Status of the Provisioning for the managed network of a machine learning workspace. + + :ivar spark_ready: + :vartype spark_ready: bool + :ivar status: Status for the managed network of a machine learning workspace. Known values are: + "Inactive" and "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus + """ + + _attribute_map = { + "spark_ready": {"key": "sparkReady", "type": "bool"}, + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, + *, + spark_ready: Optional[bool] = None, + status: Optional[Union[str, "_models.ManagedNetworkStatus"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword spark_ready: + :paramtype spark_ready: bool + :keyword status: Status for the managed network of a machine learning workspace. Known values + are: "Inactive" and "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ManagedNetworkStatus + """ + super().__init__(**kwargs) + self.spark_ready = spark_ready + self.status = status + + +class ManagedNetworkSettings(_serialization.Model): + """Managed Network settings for a machine learning workspace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar firewall_sku: Firewall Sku used for FQDN Rules. Known values are: "Standard" and "Basic". + :vartype firewall_sku: str or ~azure.mgmt.machinelearningservices.models.FirewallSku + :ivar isolation_mode: Isolation mode for the managed network of a machine learning workspace. + Known values are: "Disabled", "AllowInternetOutbound", and "AllowOnlyApprovedOutbound". + :vartype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode + :ivar network_id: + :vartype network_id: str + :ivar outbound_rules: Dictionary of :code:``. + :vartype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :ivar status: Status of the Provisioning for the managed network of a machine learning + workspace. + :vartype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + :ivar changeable_isolation_modes: + :vartype changeable_isolation_modes: list[str or + ~azure.mgmt.machinelearningservices.models.IsolationMode] + """ + + _validation = { + "network_id": {"readonly": True}, + "changeable_isolation_modes": {"readonly": True}, + } + + _attribute_map = { + "firewall_sku": {"key": "firewallSku", "type": "str"}, + "isolation_mode": {"key": "isolationMode", "type": "str"}, + "network_id": {"key": "networkId", "type": "str"}, + "outbound_rules": {"key": "outboundRules", "type": "{OutboundRule}"}, + "status": {"key": "status", "type": "ManagedNetworkProvisionStatus"}, + "changeable_isolation_modes": {"key": "changeableIsolationModes", "type": "[str]"}, + } + + def __init__( + self, + *, + firewall_sku: Optional[Union[str, "_models.FirewallSku"]] = None, + isolation_mode: Optional[Union[str, "_models.IsolationMode"]] = None, + outbound_rules: Optional[Dict[str, "_models.OutboundRule"]] = None, + status: Optional["_models.ManagedNetworkProvisionStatus"] = None, + **kwargs: Any + ) -> None: + """ + :keyword firewall_sku: Firewall Sku used for FQDN Rules. Known values are: "Standard" and + "Basic". + :paramtype firewall_sku: str or ~azure.mgmt.machinelearningservices.models.FirewallSku + :keyword isolation_mode: Isolation mode for the managed network of a machine learning + workspace. Known values are: "Disabled", "AllowInternetOutbound", and + "AllowOnlyApprovedOutbound". + :paramtype isolation_mode: str or ~azure.mgmt.machinelearningservices.models.IsolationMode + :keyword outbound_rules: Dictionary of :code:``. + :paramtype outbound_rules: dict[str, ~azure.mgmt.machinelearningservices.models.OutboundRule] + :keyword status: Status of the Provisioning for the managed network of a machine learning + workspace. + :paramtype status: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus + """ + super().__init__(**kwargs) + self.firewall_sku = firewall_sku + self.isolation_mode = isolation_mode + self.network_id = None + self.outbound_rules = outbound_rules + self.status = status + self.changeable_isolation_modes = None + + +class ManagedOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=too-many-instance-attributes + """Properties specific to a ManagedOnlineDeployment. + + 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 server. + + :ivar code_configuration: Code configuration for the endpoint deployment. + :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. + :vartype environment_id: str + :ivar environment_variables: Environment variables configuration for the deployment. + :vartype environment_variables: dict[str, str] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar app_insights_enabled: If true, enables Application Insights logging. + :vartype app_insights_enabled: bool + :ivar data_collector: The mdc configuration, we disable mdc when it's null. + :vartype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :ivar egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :vartype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known + values are: "Managed", "Kubernetes", and "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar instance_type: Compute instance type. + :vartype instance_type: str + :ivar liveness_probe: Liveness probe monitors the health of the container regularly. + :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar model: The URI path to the model. + :vartype model: str + :ivar model_mount_path: The path to mount the model in custom container. + :vartype model_mount_path: str + :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: + "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState + :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :ivar request_settings: Request settings for the deployment. + :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :ivar scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + + _validation = { + "endpoint_compute_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + "description": {"key": "description", "type": "str"}, + "environment_id": {"key": "environmentId", "type": "str"}, + "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "properties": {"key": "properties", "type": "{str}"}, + "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, + "data_collector": {"key": "dataCollector", "type": "DataCollector"}, + "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, + "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, + "model": {"key": "model", "type": "str"}, + "model_mount_path": {"key": "modelMountPath", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, + "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, + "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, + } + + def __init__( + self, + *, + code_configuration: Optional["_models.CodeConfiguration"] = None, + description: Optional[str] = None, + environment_id: Optional[str] = None, + environment_variables: Optional[Dict[str, str]] = None, + properties: Optional[Dict[str, str]] = None, + app_insights_enabled: bool = False, + data_collector: Optional["_models.DataCollector"] = None, + egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, + instance_type: Optional[str] = None, + liveness_probe: Optional["_models.ProbeSettings"] = None, + model: Optional[str] = None, + model_mount_path: Optional[str] = None, + readiness_probe: Optional["_models.ProbeSettings"] = None, + request_settings: Optional["_models.OnlineRequestSettings"] = None, + scale_settings: Optional["_models.OnlineScaleSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword code_configuration: Code configuration for the endpoint deployment. + :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. + :paramtype environment_id: str + :keyword environment_variables: Environment variables configuration for the deployment. + :paramtype environment_variables: dict[str, str] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword app_insights_enabled: If true, enables Application Insights logging. + :paramtype app_insights_enabled: bool + :keyword data_collector: The mdc configuration, we disable mdc when it's null. + :paramtype data_collector: ~azure.mgmt.machinelearningservices.models.DataCollector + :keyword egress_public_network_access: If Enabled, allow egress public network access. If + Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and + "Disabled". + :paramtype egress_public_network_access: str or + ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType + :keyword instance_type: Compute instance type. + :paramtype instance_type: str + :keyword liveness_probe: Liveness probe monitors the health of the container regularly. + :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword model: The URI path to the model. + :paramtype model: str + :keyword model_mount_path: The path to mount the model in custom container. + :paramtype model_mount_path: str + :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. + The properties and defaults are the same as liveness probe. + :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings + :keyword request_settings: Request settings for the deployment. + :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings + :keyword scale_settings: Scale settings for the deployment. + If it is null or not provided, + it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment + and to DefaultScaleSettings for ManagedOnlineDeployment. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + """ + super().__init__( + code_configuration=code_configuration, + description=description, + environment_id=environment_id, + environment_variables=environment_variables, + properties=properties, + app_insights_enabled=app_insights_enabled, + data_collector=data_collector, + egress_public_network_access=egress_public_network_access, + instance_type=instance_type, + liveness_probe=liveness_probe, + model=model, + model_mount_path=model_mount_path, + readiness_probe=readiness_probe, + request_settings=request_settings, + scale_settings=scale_settings, + **kwargs + ) + self.endpoint_compute_type: str = "Managed" + + +class ManagedOnlineEndpointDeploymentResourceProperties( + EndpointDeploymentResourceProperties +): # pylint: disable=name-too-long + """ManagedOnlineEndpointDeploymentResourceProperties. + + 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 server. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str + :ivar endpoint_compute_type: Enum to determine endpoint compute type. Known values are: + "Managed", "Kubernetes", and "AzureMLCompute". + :vartype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :ivar model: + :vartype model: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, + "model": {"key": "model", "type": "str"}, + } + + def __init__( + self, + *, + failure_reason: Optional[str] = None, + endpoint_compute_type: Optional[Union[str, "_models.EndpointComputeType"]] = None, + model: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword endpoint_compute_type: Enum to determine endpoint compute type. Known values are: + "Managed", "Kubernetes", and "AzureMLCompute". + :paramtype endpoint_compute_type: str or + ~azure.mgmt.machinelearningservices.models.EndpointComputeType + :keyword model: + :paramtype model: str + """ + super().__init__(failure_reason=failure_reason, **kwargs) + self.type: str = "managedOnlineEndpoint" + self.endpoint_compute_type = endpoint_compute_type + self.model = model + + +class ManagedOnlineEndpointResourceProperties( + EndpointResourceProperties +): # pylint: disable=too-many-instance-attributes + """ManagedOnlineEndpointResourceProperties. + + 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 server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: Enum to determine endpoint authentication mode. Known values are: "AMLToken", + "Key", and "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar compute: + :vartype compute: str + :ivar description: + :vartype description: str + :ivar mirror_traffic: Dictionary of :code:``. + :vartype mirror_traffic: dict[str, int] + :ivar scoring_uri: + :vartype scoring_uri: str + :ivar traffic: Dictionary of :code:``. + :vartype traffic: dict[str, int] + """ + + _validation = { + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, + "auth_mode": {"key": "authMode", "type": "str"}, + "compute": {"key": "compute", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "mirror_traffic": {"key": "mirrorTraffic", "type": "{int}"}, + "scoring_uri": {"key": "scoringUri", "type": "str"}, + "traffic": {"key": "traffic", "type": "{int}"}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + auth_mode: Optional[Union[str, "_models.EndpointAuthMode"]] = None, + compute: Optional[str] = None, + description: Optional[str] = None, + mirror_traffic: Optional[Dict[str, int]] = None, + scoring_uri: Optional[str] = None, + traffic: Optional[Dict[str, int]] = None, + **kwargs: Any + ) -> None: + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: Enum to determine endpoint authentication mode. Known values are: + "AMLToken", "Key", and "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword compute: + :paramtype compute: str + :keyword description: + :paramtype description: str + :keyword mirror_traffic: Dictionary of :code:``. + :paramtype mirror_traffic: dict[str, int] + :keyword scoring_uri: + :paramtype scoring_uri: str + :keyword traffic: Dictionary of :code:``. + :paramtype traffic: dict[str, int] + """ + super().__init__( + associated_resource_id=associated_resource_id, + deployments=deployments, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + location=location, + name=name, + should_create_ai_services_endpoint=should_create_ai_services_endpoint, + **kwargs + ) + self.endpoint_type: str = "managedOnlineEndpoint" + self.auth_mode = auth_mode + self.compute = compute + self.description = description + self.mirror_traffic = mirror_traffic + self.scoring_uri = scoring_uri + self.traffic = traffic + + +class ManagedResourceGroupAssignedIdentities(_serialization.Model): + """Details for managed resource group assigned identities. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: Identity principal Id. + :vartype principal_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + + +class ManagedResourceGroupSettings(_serialization.Model): + """Managed resource group settings. + + :ivar assigned_identities: List of assigned identities for the managed resource group. + :vartype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] + """ + + _attribute_map = { + "assigned_identities": {"key": "assignedIdentities", "type": "[ManagedResourceGroupAssignedIdentities]"}, + } + + def __init__( + self, + *, + assigned_identities: Optional[List["_models.ManagedResourceGroupAssignedIdentities"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword assigned_identities: List of assigned identities for the managed resource group. + :paramtype assigned_identities: + list[~azure.mgmt.machinelearningservices.models.ManagedResourceGroupAssignedIdentities] + """ + super().__init__(**kwargs) + self.assigned_identities = assigned_identities + + +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + 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 server. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MarketplacePlan(_serialization.Model): + """MarketplacePlan. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar offer_id: The identifying name of the Offer of the Marketplace Plan. + :vartype offer_id: str + :ivar plan_id: The identifying name of the Plan of the Marketplace Plan. + :vartype plan_id: str + :ivar publisher_id: The identifying name of the Publisher of the Marketplace Plan. + :vartype publisher_id: str + """ + + _validation = { + "offer_id": {"readonly": True}, + "plan_id": {"readonly": True}, + "publisher_id": {"readonly": True}, + } + + _attribute_map = { + "offer_id": {"key": "offerId", "type": "str"}, + "plan_id": {"key": "planId", "type": "str"}, + "publisher_id": {"key": "publisherId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.offer_id = None + self.plan_id = None + self.publisher_id = None + + +class MarketplaceSubscription(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.MarketplaceSubscriptionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "MarketplaceSubscriptionProperties"}, + } + + def __init__(self, *, properties: "_models.MarketplaceSubscriptionProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class MarketplaceSubscriptionProperties(_serialization.Model): + """MarketplaceSubscriptionProperties. + + 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 server. + + :ivar marketplace_plan: Marketplace Plan associated with the Marketplace Subscription. + :vartype marketplace_plan: ~azure.mgmt.machinelearningservices.models.MarketplacePlan + :ivar marketplace_subscription_status: Current status of the Marketplace Subscription. Known + values are: "Subscribed", "Suspended", and "Unsubscribed". + :vartype marketplace_subscription_status: str or + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionStatus + :ivar model_id: [Required] Target Marketplace Model ID to create a Marketplace Subscription + for. Required. + :vartype model_id: str + :ivar provisioning_state: Provisioning State of the Marketplace Subscription. Known values are: + "Creating", "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.MarketplaceSubscriptionProvisioningState + """ + + _validation = { + "marketplace_plan": {"readonly": True}, + "marketplace_subscription_status": {"readonly": True}, + "model_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "marketplace_plan": {"key": "marketplacePlan", "type": "MarketplacePlan"}, + "marketplace_subscription_status": {"key": "marketplaceSubscriptionStatus", "type": "str"}, + "model_id": {"key": "modelId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, model_id: str, **kwargs: Any) -> None: + """ + :keyword model_id: [Required] Target Marketplace Model ID to create a Marketplace Subscription + for. Required. + :paramtype model_id: str + """ + super().__init__(**kwargs) + self.marketplace_plan = None + self.marketplace_subscription_status = None + self.model_id = model_id + self.provisioning_state = None + + +class MarketplaceSubscriptionResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of MarketplaceSubscription entities. + + :ivar next_link: The link to the next page of MarketplaceSubscription objects. If null, there + are no additional pages. + :vartype next_link: str + :ivar value: An array of objects of type MarketplaceSubscription. + :vartype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[MarketplaceSubscription]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.MarketplaceSubscription"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of MarketplaceSubscription objects. If null, + there are no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type MarketplaceSubscription. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class MaterializationComputeResource(_serialization.Model): + """DTO object representing compute resource. + + :ivar instance_type: Specifies the instance type. + :vartype instance_type: str + """ + + _attribute_map = { + "instance_type": {"key": "instanceType", "type": "str"}, + } + + def __init__(self, *, instance_type: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword instance_type: Specifies the instance type. + :paramtype instance_type: str + """ + super().__init__(**kwargs) + self.instance_type = instance_type + + +class MaterializationSettings(_serialization.Model): + """MaterializationSettings. + + :ivar notification: Specifies the notification details. + :vartype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :ivar resource: Specifies the compute resource settings. + :vartype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :ivar schedule: Specifies the schedule details. + :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger + :ivar spark_configuration: Specifies the spark compute settings. + :vartype spark_configuration: dict[str, str] + :ivar store_type: Specifies the stores to which materialization should happen. Known values + are: "None", "Online", "Offline", and "OnlineAndOffline". + :vartype store_type: str or ~azure.mgmt.machinelearningservices.models.MaterializationStoreType + """ + + _attribute_map = { + "notification": {"key": "notification", "type": "NotificationSetting"}, + "resource": {"key": "resource", "type": "MaterializationComputeResource"}, + "schedule": {"key": "schedule", "type": "RecurrenceTrigger"}, + "spark_configuration": {"key": "sparkConfiguration", "type": "{str}"}, + "store_type": {"key": "storeType", "type": "str"}, + } + + def __init__( + self, + *, + notification: Optional["_models.NotificationSetting"] = None, + resource: Optional["_models.MaterializationComputeResource"] = None, + schedule: Optional["_models.RecurrenceTrigger"] = None, + spark_configuration: Optional[Dict[str, str]] = None, + store_type: Optional[Union[str, "_models.MaterializationStoreType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword notification: Specifies the notification details. + :paramtype notification: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :keyword resource: Specifies the compute resource settings. + :paramtype resource: ~azure.mgmt.machinelearningservices.models.MaterializationComputeResource + :keyword schedule: Specifies the schedule details. + :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceTrigger + :keyword spark_configuration: Specifies the spark compute settings. + :paramtype spark_configuration: dict[str, str] + :keyword store_type: Specifies the stores to which materialization should happen. Known values + are: "None", "Online", "Offline", and "OnlineAndOffline". + :paramtype store_type: str or + ~azure.mgmt.machinelearningservices.models.MaterializationStoreType + """ + super().__init__(**kwargs) + self.notification = notification + self.resource = resource + self.schedule = schedule + self.spark_configuration = spark_configuration + self.store_type = store_type + + +class MedianStoppingPolicy(EarlyTerminationPolicy): + """Defines an early termination policy based on running averages of the primary metric of all + runs. + + All required parameters must be populated in order to send to server. + + :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. + :vartype delay_evaluation: int + :ivar evaluation_interval: Interval (number of runs) between policy evaluations. + :vartype evaluation_interval: int + :ivar policy_type: [Required] Name of policy configuration. Required. Known values are: + "Bandit", "MedianStopping", and "TruncationSelection". + :vartype policy_type: str or + ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicyType + """ + + _validation = { + "policy_type": {"required": True}, + } + + _attribute_map = { + "delay_evaluation": {"key": "delayEvaluation", "type": "int"}, + "evaluation_interval": {"key": "evaluationInterval", "type": "int"}, + "policy_type": {"key": "policyType", "type": "str"}, + } + + def __init__(self, *, delay_evaluation: int = 0, evaluation_interval: int = 0, **kwargs: Any) -> None: + """ + :keyword delay_evaluation: Number of intervals by which to delay the first evaluation. + :paramtype delay_evaluation: int + :keyword evaluation_interval: Interval (number of runs) between policy evaluations. + :paramtype evaluation_interval: int + """ + super().__init__(delay_evaluation=delay_evaluation, evaluation_interval=evaluation_interval, **kwargs) + self.policy_type: str = "MedianStopping" + + +class MLFlowModelJobInput(AssetJobInput, JobInput): + """MLFlowModelJobInput. + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + """ + + _validation = { + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description for the input. + :paramtype description: str + :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "mlflow_model" + self.mode = mode + self.uri = uri + + +class MLFlowModelJobOutput(AssetJobOutput, JobOutput): + """MLFlowModelJobOutput. + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the output. + :vartype description: str + :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 asset_name: Output Asset Name. + :vartype asset_name: 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 + """ + + _validation = { + "job_output_type": {"required": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description for the output. + :paramtype description: str + :keyword asset_name: Output Asset Name. + :paramtype asset_name: 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__(asset_name=asset_name, mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_output_type: str = "mlflow_model" + self.asset_name = asset_name + self.mode = mode + self.uri = uri + + +class MLTableData(DataVersionBaseProperties): + """MLTable data definition. + + All required parameters must be populated in order to send to server. + + :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 is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :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. 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] + """ + + _validation = { + "data_type": {"required": True}, + "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "data_type": {"key": "dataType", "type": "str"}, + "data_uri": {"key": "dataUri", "type": "str"}, + "referenced_uris": {"key": "referencedUris", "type": "[str]"}, + } + + def __init__( + self, + *, + data_uri: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + referenced_uris: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :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] + """ + super().__init__( + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, + data_uri=data_uri, + **kwargs + ) + self.data_type: str = "mltable" + self.referenced_uris = referenced_uris + + +class MLTableJobInput(AssetJobInput, JobInput): + """MLTableJobInput. + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the input. + :vartype description: str + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + """ + + _validation = { + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + uri: str, + description: Optional[str] = None, + mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description for the input. + :paramtype description: str + :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", + "Download", "Direct", "EvalMount", and "EvalDownload". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + """ + super().__init__(mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_input_type: str = "mltable" + self.mode = mode + self.uri = uri + + +class MLTableJobOutput(AssetJobOutput, JobOutput): + """MLTableJobOutput. + + All required parameters must be populated in order to send to server. + + :ivar description: Description for the output. + :vartype description: str + :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 asset_name: Output Asset Name. + :vartype asset_name: 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 + """ + + _validation = { + "job_output_type": {"required": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, + "mode": {"key": "mode", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + asset_name: Optional[str] = None, + mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, + uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: Description for the output. + :paramtype description: str + :keyword asset_name: Output Asset Name. + :paramtype asset_name: 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__(asset_name=asset_name, mode=mode, uri=uri, description=description, **kwargs) + self.description = description + self.job_output_type: str = "mltable" + self.asset_name = asset_name + self.mode = mode + self.uri = uri + + +class ModelContainer(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.ModelContainerProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "ModelContainerProperties"}, + } + + def __init__(self, *, properties: "_models.ModelContainerProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ModelContainerProperties(AssetContainer): + """ModelContainerProperties. + + 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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar latest_version: The latest version inside this container. + :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 = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "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__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_archived: bool = False, + **kwargs: Any + ) -> None: + """ + :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 is_archived: Is the asset archived?. + :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): + """A paginated list of ModelContainer entities. + + :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ModelContainer. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ModelContainer]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelContainer"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ModelContainer. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ModelSettings(_serialization.Model): + """ModelSettings. + + :ivar model_id: The unique model identifier that this ServerlessEndpoint should provision. + :vartype model_id: str + """ + + _attribute_map = { + "model_id": {"key": "modelId", "type": "str"}, + } + + def __init__(self, *, model_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword model_id: The unique model identifier that this ServerlessEndpoint should provision. + :paramtype model_id: str + """ + super().__init__(**kwargs) + self.model_id = model_id + + +class ModelVersion(ProxyResource): + """Azure Resource Manager resource envelope. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.ModelVersionProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "ModelVersionProperties"}, + } + + def __init__(self, *, properties: "_models.ModelVersionProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ModelVersionProperties(AssetBase): # pylint: disable=too-many-instance-attributes + """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. + :vartype properties: dict[str, str] + :ivar tags: Tag dictionary. Tags can be added, removed, and updated. + :vartype tags: dict[str, str] + :ivar is_anonymous: If the name version are system generated (anonymous registration). + :vartype is_anonymous: bool + :ivar is_archived: Is the asset archived?. + :vartype is_archived: bool + :ivar flavors: Mapping of model flavors to their properties. + :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :ivar job_name: Name of the training job which produced this model. + :vartype job_name: str + :ivar model_type: The storage format for this entity. Used for NCD. + :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 + :ivar stage: Stage in the model lifecycle assigned to this model. + :vartype stage: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "is_anonymous": {"key": "isAnonymous", "type": "bool"}, + "is_archived": {"key": "isArchived", "type": "bool"}, + "flavors": {"key": "flavors", "type": "{FlavorData}"}, + "job_name": {"key": "jobName", "type": "str"}, + "model_type": {"key": "modelType", "type": "str"}, + "model_uri": {"key": "modelUri", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "stage": {"key": "stage", "type": "str"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + is_anonymous: bool = False, + is_archived: bool = False, + flavors: Optional[Dict[str, "_models.FlavorData"]] = None, + job_name: Optional[str] = None, + model_type: Optional[str] = None, + model_uri: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :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 is_anonymous: If the name version are system generated (anonymous registration). + :paramtype is_anonymous: bool + :keyword is_archived: Is the asset archived?. + :paramtype is_archived: bool + :keyword flavors: Mapping of model flavors to their properties. + :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] + :keyword job_name: Name of the training job which produced this model. + :paramtype job_name: str + :keyword model_type: The storage format for this entity. Used for NCD. + :paramtype model_type: str + :keyword model_uri: The URI path to the model contents. + :paramtype model_uri: str + :keyword stage: Stage in the model lifecycle assigned to this model. + :paramtype stage: str """ super().__init__( - advanced_settings=advanced_settings, - ams_gradient=ams_gradient, - augmentations=augmentations, - beta1=beta1, - beta2=beta2, - checkpoint_frequency=checkpoint_frequency, - checkpoint_model=checkpoint_model, - checkpoint_run_id=checkpoint_run_id, - distributed=distributed, - early_stopping=early_stopping, - early_stopping_delay=early_stopping_delay, - early_stopping_patience=early_stopping_patience, - enable_onnx_normalization=enable_onnx_normalization, - evaluation_frequency=evaluation_frequency, - gradient_accumulation_step=gradient_accumulation_step, - layers_to_freeze=layers_to_freeze, - learning_rate=learning_rate, - learning_rate_scheduler=learning_rate_scheduler, - model_name=model_name, - momentum=momentum, - nesterov=nesterov, - number_of_epochs=number_of_epochs, - number_of_workers=number_of_workers, - optimizer=optimizer, - random_seed=random_seed, - step_lr_gamma=step_lr_gamma, - step_lr_step_size=step_lr_step_size, - training_batch_size=training_batch_size, - validation_batch_size=validation_batch_size, - warmup_cosine_lr_cycles=warmup_cosine_lr_cycles, - warmup_cosine_lr_warmup_epochs=warmup_cosine_lr_warmup_epochs, - weight_decay=weight_decay, + description=description, + properties=properties, + tags=tags, + is_anonymous=is_anonymous, + is_archived=is_archived, **kwargs ) - self.box_detections_per_image = box_detections_per_image - self.box_score_threshold = box_score_threshold - self.image_size = image_size - self.max_size = max_size - self.min_size = min_size - self.model_size = model_size - self.multi_scale = multi_scale - self.nms_iou_threshold = nms_iou_threshold - self.tile_grid_size = tile_grid_size - self.tile_overlap_ratio = tile_overlap_ratio - self.tile_predictions_nms_threshold = tile_predictions_nms_threshold - self.validation_iou_threshold = validation_iou_threshold - self.validation_metric_type = validation_metric_type + self.flavors = flavors + self.job_name = job_name + self.model_type = model_type + self.model_uri = model_uri + self.provisioning_state = None + self.stage = stage + + +class ModelVersionResourceArmPaginatedResult(_serialization.Model): + """A paginated list of ModelVersion entities. + + :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ModelVersion. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ModelVersion]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelVersion"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ModelVersion. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class MonitorComputeConfigurationBase(_serialization.Model): + """Monitor compute configuration base definition. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + MonitorServerlessSparkCompute + + All required parameters must be populated in order to send to server. + + :ivar compute_type: [Required] Specifies the type of signal to monitor. Required. + "ServerlessSpark" + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + """ + + _validation = { + "compute_type": {"required": True}, + } + + _attribute_map = { + "compute_type": {"key": "computeType", "type": "str"}, + } + + _subtype_map = {"compute_type": {"ServerlessSpark": "MonitorServerlessSparkCompute"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.compute_type: Optional[str] = None + + +class MonitorDefinition(_serialization.Model): + """MonitorDefinition. + + All required parameters must be populated in order to send to server. + + :ivar alert_notification_settings: The monitor's notification settings. + :vartype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :ivar compute_configuration: [Required] The ARM resource ID of the compute resource to run the + monitoring job on. Required. + :vartype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :ivar monitoring_target: The entities targeted by the monitor. + :vartype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :ivar signals: [Required] The signals to monitor. Required. + :vartype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + """ + + _validation = { + "compute_configuration": {"required": True}, + "signals": {"required": True}, + } + + _attribute_map = { + "alert_notification_settings": {"key": "alertNotificationSettings", "type": "MonitorNotificationSettings"}, + "compute_configuration": {"key": "computeConfiguration", "type": "MonitorComputeConfigurationBase"}, + "monitoring_target": {"key": "monitoringTarget", "type": "MonitoringTarget"}, + "signals": {"key": "signals", "type": "{MonitoringSignalBase}"}, + } + + def __init__( + self, + *, + compute_configuration: "_models.MonitorComputeConfigurationBase", + signals: Dict[str, "_models.MonitoringSignalBase"], + alert_notification_settings: Optional["_models.MonitorNotificationSettings"] = None, + monitoring_target: Optional["_models.MonitoringTarget"] = None, + **kwargs: Any + ) -> None: + """ + :keyword alert_notification_settings: The monitor's notification settings. + :paramtype alert_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorNotificationSettings + :keyword compute_configuration: [Required] The ARM resource ID of the compute resource to run + the monitoring job on. Required. + :paramtype compute_configuration: + ~azure.mgmt.machinelearningservices.models.MonitorComputeConfigurationBase + :keyword monitoring_target: The entities targeted by the monitor. + :paramtype monitoring_target: ~azure.mgmt.machinelearningservices.models.MonitoringTarget + :keyword signals: [Required] The signals to monitor. Required. + :paramtype signals: dict[str, ~azure.mgmt.machinelearningservices.models.MonitoringSignalBase] + """ + super().__init__(**kwargs) + self.alert_notification_settings = alert_notification_settings + self.compute_configuration = compute_configuration + self.monitoring_target = monitoring_target + self.signals = signals + + +class MonitorEmailNotificationSettings(_serialization.Model): + """MonitorEmailNotificationSettings. + + :ivar emails: The email recipient list which has a limitation of 499 characters in total. + :vartype emails: list[str] + """ + + _attribute_map = { + "emails": {"key": "emails", "type": "[str]"}, + } + + def __init__(self, *, emails: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword emails: The email recipient list which has a limitation of 499 characters in total. + :paramtype emails: list[str] + """ + super().__init__(**kwargs) + self.emails = emails + + +class MonitoringTarget(_serialization.Model): + """Monitoring target definition. + + All required parameters must be populated in order to send to server. + + :ivar deployment_id: Reference to the deployment asset targeted by this monitor. + :vartype deployment_id: str + :ivar model_id: Reference to the model asset targeted by this monitor. + :vartype model_id: str + :ivar task_type: [Required] The machine learning task type of the monitored model. Required. + Known values are: "Classification" and "Regression". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType + """ + + _validation = { + "task_type": {"required": True}, + } + + _attribute_map = { + "deployment_id": {"key": "deploymentId", "type": "str"}, + "model_id": {"key": "modelId", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + } + + def __init__( + self, + *, + task_type: Union[str, "_models.ModelTaskType"], + deployment_id: Optional[str] = None, + model_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword deployment_id: Reference to the deployment asset targeted by this monitor. + :paramtype deployment_id: str + :keyword model_id: Reference to the model asset targeted by this monitor. + :paramtype model_id: str + :keyword task_type: [Required] The machine learning task type of the monitored model. Required. + Known values are: "Classification" and "Regression". + :paramtype task_type: str or ~azure.mgmt.machinelearningservices.models.ModelTaskType + """ + super().__init__(**kwargs) + self.deployment_id = deployment_id + self.model_id = model_id + self.task_type = task_type + + +class MonitoringThreshold(_serialization.Model): + """MonitoringThreshold. + + :ivar value: The threshold value. If null, the set default is dependent on the metric type. + :vartype value: float + """ + + _attribute_map = { + "value": {"key": "value", "type": "float"}, + } + + def __init__(self, *, value: Optional[float] = None, **kwargs: Any) -> None: + """ + :keyword value: The threshold value. If null, the set default is dependent on the metric type. + :paramtype value: float + """ + super().__init__(**kwargs) + self.value = value + + +class MonitorNotificationSettings(_serialization.Model): + """MonitorNotificationSettings. + + :ivar email_notification_settings: The AML notification email settings. + :vartype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings + """ + + _attribute_map = { + "email_notification_settings": {"key": "emailNotificationSettings", "type": "MonitorEmailNotificationSettings"}, + } + + def __init__( + self, *, email_notification_settings: Optional["_models.MonitorEmailNotificationSettings"] = None, **kwargs: Any + ) -> None: + """ + :keyword email_notification_settings: The AML notification email settings. + :paramtype email_notification_settings: + ~azure.mgmt.machinelearningservices.models.MonitorEmailNotificationSettings + """ + super().__init__(**kwargs) + self.email_notification_settings = email_notification_settings + + +class MonitorServerlessSparkCompute(MonitorComputeConfigurationBase): + """Monitor serverless spark compute definition. + + All required parameters must be populated in order to send to server. + + :ivar compute_type: [Required] Specifies the type of signal to monitor. Required. + "ServerlessSpark" + :vartype compute_type: str or ~azure.mgmt.machinelearningservices.models.MonitorComputeType + :ivar compute_identity: [Required] The identity scheme leveraged to by the spark jobs running + on serverless Spark. Required. + :vartype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :ivar instance_type: [Required] The instance type running the Spark job. Required. + :vartype instance_type: str + :ivar runtime_version: [Required] The Spark runtime version. Required. + :vartype runtime_version: str + """ + + _validation = { + "compute_type": {"required": True}, + "compute_identity": {"required": True}, + "instance_type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "runtime_version": {"required": True, "min_length": 1, "pattern": r"^[0-9]+\.[0-9]+$"}, + } + + _attribute_map = { + "compute_type": {"key": "computeType", "type": "str"}, + "compute_identity": {"key": "computeIdentity", "type": "MonitorComputeIdentityBase"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, + } + + def __init__( + self, + *, + compute_identity: "_models.MonitorComputeIdentityBase", + instance_type: str, + runtime_version: str, + **kwargs: Any + ) -> None: + """ + :keyword compute_identity: [Required] The identity scheme leveraged to by the spark jobs + running on serverless Spark. Required. + :paramtype compute_identity: + ~azure.mgmt.machinelearningservices.models.MonitorComputeIdentityBase + :keyword instance_type: [Required] The instance type running the Spark job. Required. + :paramtype instance_type: str + :keyword runtime_version: [Required] The Spark runtime version. Required. + :paramtype runtime_version: str + """ + super().__init__(**kwargs) + self.compute_type: str = "ServerlessSpark" + self.compute_identity = compute_identity + self.instance_type = instance_type + self.runtime_version = runtime_version + + +class Mpi(DistributionConfiguration): + """MPI distribution configuration. + + All required parameters must be populated in order to send to server. + + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", and "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per MPI node. + :vartype process_count_per_instance: int + """ + + _validation = { + "distribution_type": {"required": True}, + } + + _attribute_map = { + "distribution_type": {"key": "distributionType", "type": "str"}, + "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, + } + def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword process_count_per_instance: Number of processes per MPI node. + :paramtype process_count_per_instance: int + """ + super().__init__(**kwargs) + self.distribution_type: str = "Mpi" + self.process_count_per_instance = process_count_per_instance -class ImageObjectDetection(ImageObjectDetectionBase, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Image Object Detection. Object detection is used to identify objects in an image and locate - each object with a - bounding box e.g. locate all dogs and cats in an image and draw a bounding box around each. - All required parameters must be populated in order to send to Azure. +class NetworkAcls(_serialization.Model): + """NetworkAcls. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar limit_settings: [Required] Limit settings for the AutoML job. Required. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :ivar sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :vartype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar model_settings: Settings used for training the model. - :vartype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :ivar search_space: Search space for sampling different combinations of models and their - hyperparameters. - :vartype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :ivar primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules + match. This is only used after the bypass property has been evaluated. Known values are: "Deny" + and "Allow". + :vartype default_action: str or ~azure.mgmt.machinelearningservices.models.DefaultActionType + :ivar ip_rules: Rules governing the accessibility of a resource from a specific ip address or + ip range. + :vartype ip_rules: list[~azure.mgmt.machinelearningservices.models.IPRule] """ - _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, - "limit_settings": {"required": True}, + _attribute_map = { + "default_action": {"key": "defaultAction", "type": "str"}, + "ip_rules": {"key": "ipRules", "type": "[IPRule]"}, } + def __init__( + self, + *, + default_action: Optional[Union[str, "_models.DefaultActionType"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Known values are: "Deny" and "Allow". + :paramtype default_action: str or ~azure.mgmt.machinelearningservices.models.DefaultActionType + :keyword ip_rules: Rules governing the accessibility of a resource from a specific ip address + or ip range. + :paramtype ip_rules: list[~azure.mgmt.machinelearningservices.models.IPRule] + """ + super().__init__(**kwargs) + self.default_action = default_action + self.ip_rules = ip_rules + + +class NlpVertical(_serialization.Model): + """Abstract class for NLP related AutoML tasks. + NLP - Natural Language Processing. + + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :ivar limit_settings: Execution constraints for AutoMLJob. + :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + """ + _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "limit_settings": {"key": "limitSettings", "type": "ImageLimitSettings"}, - "sweep_settings": {"key": "sweepSettings", "type": "ImageSweepSettings"}, + "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, + "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "model_settings": {"key": "modelSettings", "type": "ImageModelSettingsObjectDetection"}, - "search_space": {"key": "searchSpace", "type": "[ImageModelDistributionSettingsObjectDetection]"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, } def __init__( self, *, - training_data: "_models.MLTableJobInput", - limit_settings: "_models.ImageLimitSettings", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - sweep_settings: Optional["_models.ImageSweepSettings"] = None, + featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, + limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - model_settings: Optional["_models.ImageModelSettingsObjectDetection"] = None, - search_space: Optional[List["_models.ImageModelDistributionSettingsObjectDetection"]] = None, - primary_metric: Optional[Union[str, "_models.ObjectDetectionPrimaryMetrics"]] = None, **kwargs: Any ) -> None: """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword limit_settings: [Required] Limit settings for the AutoML job. Required. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.ImageLimitSettings - :keyword sweep_settings: Model sweeping and hyperparameter sweeping related settings. - :paramtype sweep_settings: ~azure.mgmt.machinelearningservices.models.ImageSweepSettings + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings :keyword validation_data: Validation data inputs. :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword model_settings: Settings used for training the model. - :paramtype model_settings: - ~azure.mgmt.machinelearningservices.models.ImageModelSettingsObjectDetection - :keyword search_space: Search space for sampling different combinations of models and their - hyperparameters. - :paramtype search_space: - list[~azure.mgmt.machinelearningservices.models.ImageModelDistributionSettingsObjectDetection] - :keyword primary_metric: Primary metric to optimize for this task. "MeanAveragePrecision" - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.ObjectDetectionPrimaryMetrics + """ + super().__init__(**kwargs) + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.validation_data = validation_data + + +class NlpVerticalFeaturizationSettings(FeaturizationSettings): + """NlpVerticalFeaturizationSettings. + + :ivar dataset_language: Dataset language, useful for the text data. + :vartype dataset_language: str + """ + + +class NlpVerticalLimitSettings(_serialization.Model): + """Job execution constraints. + + :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. + :vartype max_concurrent_trials: int + :ivar max_trials: Number of AutoML iterations. + :vartype max_trials: int + :ivar timeout: AutoML job timeout. + :vartype timeout: ~datetime.timedelta + """ + + _attribute_map = { + "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, + "max_trials": {"key": "maxTrials", "type": "int"}, + "timeout": {"key": "timeout", "type": "duration"}, + } + + def __init__( + self, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any + ) -> None: + """ + :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. + :paramtype max_concurrent_trials: int + :keyword max_trials: Number of AutoML iterations. + :paramtype max_trials: int + :keyword timeout: AutoML job timeout. + :paramtype timeout: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.max_concurrent_trials = max_concurrent_trials + self.max_trials = max_trials + self.timeout = timeout + + +class NodeStateCounts(_serialization.Model): + """Counts of various compute node states on the amlCompute. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar idle_node_count: Number of compute nodes in idle state. + :vartype idle_node_count: int + :ivar running_node_count: Number of compute nodes which are running jobs. + :vartype running_node_count: int + :ivar preparing_node_count: Number of compute nodes which are being prepared. + :vartype preparing_node_count: int + :ivar unusable_node_count: Number of compute nodes which are in unusable state. + :vartype unusable_node_count: int + :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. + :vartype leaving_node_count: int + :ivar preempted_node_count: Number of compute nodes which are in preempted state. + :vartype preempted_node_count: int + """ + + _validation = { + "idle_node_count": {"readonly": True}, + "running_node_count": {"readonly": True}, + "preparing_node_count": {"readonly": True}, + "unusable_node_count": {"readonly": True}, + "leaving_node_count": {"readonly": True}, + "preempted_node_count": {"readonly": True}, + } + + _attribute_map = { + "idle_node_count": {"key": "idleNodeCount", "type": "int"}, + "running_node_count": {"key": "runningNodeCount", "type": "int"}, + "preparing_node_count": {"key": "preparingNodeCount", "type": "int"}, + "unusable_node_count": {"key": "unusableNodeCount", "type": "int"}, + "leaving_node_count": {"key": "leavingNodeCount", "type": "int"}, + "preempted_node_count": {"key": "preemptedNodeCount", "type": "int"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.idle_node_count = None + self.running_node_count = None + self.preparing_node_count = None + self.unusable_node_count = None + self.leaving_node_count = None + self.preempted_node_count = None + + +class NoneAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """NoneAuthTypeWorkspaceConnectionProperties. + + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + def __init__( + self, + *, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool """ super().__init__( - limit_settings=limit_settings, - sweep_settings=sweep_settings, - validation_data=validation_data, - validation_data_size=validation_data_size, - model_settings=model_settings, - search_space=search_space, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, **kwargs ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "ImageObjectDetection" - self.training_data = training_data - self.primary_metric = primary_metric - self.limit_settings = limit_settings - self.sweep_settings = sweep_settings - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.model_settings = model_settings - self.search_space = search_space + self.auth_type: str = "None" -class ImageSweepSettings(_serialization.Model): - """Model sweeping and hyperparameter sweeping related settings. +class NoneDatastoreCredentials(DatastoreCredentials): + """Empty/none datastore credentials. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar early_termination: Type of early termination policy. - :vartype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy - :ivar sampling_algorithm: [Required] Type of the hyperparameter sampling algorithms. Required. - Known values are: "Grid", "Random", and "Bayesian". - :vartype sampling_algorithm: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType """ _validation = { - "sampling_algorithm": {"required": True}, + "credentials_type": {"required": True}, } _attribute_map = { - "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, - "sampling_algorithm": {"key": "samplingAlgorithm", "type": "str"}, + "credentials_type": {"key": "credentialsType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.credentials_type: str = "None" + + +class NotebookAccessTokenResult(_serialization.Model): + """NotebookAccessTokenResult. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar access_token: + :vartype access_token: str + :ivar expires_in: + :vartype expires_in: int + :ivar host_name: + :vartype host_name: str + :ivar notebook_resource_id: + :vartype notebook_resource_id: str + :ivar public_dns: + :vartype public_dns: str + :ivar refresh_token: + :vartype refresh_token: str + :ivar scope: + :vartype scope: str + :ivar token_type: + :vartype token_type: str + """ + + _validation = { + "access_token": {"readonly": True}, + "expires_in": {"readonly": True}, + "host_name": {"readonly": True}, + "notebook_resource_id": {"readonly": True}, + "public_dns": {"readonly": True}, + "refresh_token": {"readonly": True}, + "scope": {"readonly": True}, + "token_type": {"readonly": True}, + } + + _attribute_map = { + "access_token": {"key": "accessToken", "type": "str"}, + "expires_in": {"key": "expiresIn", "type": "int"}, + "host_name": {"key": "hostName", "type": "str"}, + "notebook_resource_id": {"key": "notebookResourceId", "type": "str"}, + "public_dns": {"key": "publicDns", "type": "str"}, + "refresh_token": {"key": "refreshToken", "type": "str"}, + "scope": {"key": "scope", "type": "str"}, + "token_type": {"key": "tokenType", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.access_token = None + self.expires_in = None + self.host_name = None + self.notebook_resource_id = None + self.public_dns = None + self.refresh_token = None + self.scope = None + self.token_type = None + + +class NotebookPreparationError(_serialization.Model): + """NotebookPreparationError. + + :ivar error_message: + :vartype error_message: str + :ivar status_code: + :vartype status_code: int + """ + + _attribute_map = { + "error_message": {"key": "errorMessage", "type": "str"}, + "status_code": {"key": "statusCode", "type": "int"}, } def __init__( - self, - *, - sampling_algorithm: Union[str, "_models.SamplingAlgorithmType"], - early_termination: Optional["_models.EarlyTerminationPolicy"] = None, - **kwargs: Any + self, *, error_message: Optional[str] = None, status_code: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword early_termination: Type of early termination policy. - :paramtype early_termination: ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicy - :keyword sampling_algorithm: [Required] Type of the hyperparameter sampling algorithms. - Required. Known values are: "Grid", "Random", and "Bayesian". - :paramtype sampling_algorithm: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :keyword error_message: + :paramtype error_message: str + :keyword status_code: + :paramtype status_code: int """ super().__init__(**kwargs) - self.early_termination = early_termination - self.sampling_algorithm = sampling_algorithm + self.error_message = error_message + self.status_code = status_code -class InferenceContainerProperties(_serialization.Model): - """InferenceContainerProperties. +class NotebookResourceInfo(_serialization.Model): + """NotebookResourceInfo. - :ivar liveness_route: The route to check the liveness of the inference server container. - :vartype liveness_route: ~azure.mgmt.machinelearningservices.models.Route - :ivar readiness_route: The route to check the readiness of the inference server container. - :vartype readiness_route: ~azure.mgmt.machinelearningservices.models.Route - :ivar scoring_route: The port to send the scoring requests to, within the inference server - container. - :vartype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + :ivar fqdn: + :vartype fqdn: str + :ivar is_private_link_enabled: + :vartype is_private_link_enabled: bool + :ivar notebook_preparation_error: The error that occurs when preparing notebook. + :vartype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :ivar resource_id: the data plane resourceId that used to initialize notebook component. + :vartype resource_id: str """ _attribute_map = { - "liveness_route": {"key": "livenessRoute", "type": "Route"}, - "readiness_route": {"key": "readinessRoute", "type": "Route"}, - "scoring_route": {"key": "scoringRoute", "type": "Route"}, + "fqdn": {"key": "fqdn", "type": "str"}, + "is_private_link_enabled": {"key": "isPrivateLinkEnabled", "type": "bool"}, + "notebook_preparation_error": {"key": "notebookPreparationError", "type": "NotebookPreparationError"}, + "resource_id": {"key": "resourceId", "type": "str"}, } def __init__( self, *, - liveness_route: Optional["_models.Route"] = None, - readiness_route: Optional["_models.Route"] = None, - scoring_route: Optional["_models.Route"] = None, + fqdn: Optional[str] = None, + is_private_link_enabled: Optional[bool] = None, + notebook_preparation_error: Optional["_models.NotebookPreparationError"] = None, + resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword liveness_route: The route to check the liveness of the inference server container. - :paramtype liveness_route: ~azure.mgmt.machinelearningservices.models.Route - :keyword readiness_route: The route to check the readiness of the inference server container. - :paramtype readiness_route: ~azure.mgmt.machinelearningservices.models.Route - :keyword scoring_route: The port to send the scoring requests to, within the inference server - container. - :paramtype scoring_route: ~azure.mgmt.machinelearningservices.models.Route + :keyword fqdn: + :paramtype fqdn: str + :keyword is_private_link_enabled: + :paramtype is_private_link_enabled: bool + :keyword notebook_preparation_error: The error that occurs when preparing notebook. + :paramtype notebook_preparation_error: + ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword resource_id: the data plane resourceId that used to initialize notebook component. + :paramtype resource_id: str """ super().__init__(**kwargs) - self.liveness_route = liveness_route - self.readiness_route = readiness_route - self.scoring_route = scoring_route + self.fqdn = fqdn + self.is_private_link_enabled = is_private_link_enabled + self.notebook_preparation_error = notebook_preparation_error + self.resource_id = resource_id -class InstanceTypeSchema(_serialization.Model): - """Instance type schema. +class NotificationSetting(_serialization.Model): + """Configuration for notification. - :ivar node_selector: Node Selector. - :vartype node_selector: dict[str, str] - :ivar resources: Resource requests/limits for this instance type. - :vartype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + :ivar email_on: Send email notification to user on specified notification type. + :vartype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :ivar emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :vartype emails: list[str] + :ivar webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :vartype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ _attribute_map = { - "node_selector": {"key": "nodeSelector", "type": "{str}"}, - "resources": {"key": "resources", "type": "InstanceTypeSchemaResources"}, + "email_on": {"key": "emailOn", "type": "[str]"}, + "emails": {"key": "emails", "type": "[str]"}, + "webhooks": {"key": "webhooks", "type": "{Webhook}"}, } def __init__( self, *, - node_selector: Optional[Dict[str, str]] = None, - resources: Optional["_models.InstanceTypeSchemaResources"] = None, + email_on: Optional[List[Union[str, "_models.EmailNotificationEnableType"]]] = None, + emails: Optional[List[str]] = None, + webhooks: Optional[Dict[str, "_models.Webhook"]] = None, **kwargs: Any ) -> None: """ - :keyword node_selector: Node Selector. - :paramtype node_selector: dict[str, str] - :keyword resources: Resource requests/limits for this instance type. - :paramtype resources: ~azure.mgmt.machinelearningservices.models.InstanceTypeSchemaResources + :keyword email_on: Send email notification to user on specified notification type. + :paramtype email_on: list[str or + ~azure.mgmt.machinelearningservices.models.EmailNotificationEnableType] + :keyword emails: This is the email recipient list which has a limitation of 499 characters in + total concat with comma separator. + :paramtype emails: list[str] + :keyword webhooks: Send webhook callback to a service. Key is a user-provided name for the + webhook. + :paramtype webhooks: dict[str, ~azure.mgmt.machinelearningservices.models.Webhook] """ super().__init__(**kwargs) - self.node_selector = node_selector - self.resources = resources + self.email_on = email_on + self.emails = emails + self.webhooks = webhooks -class InstanceTypeSchemaResources(_serialization.Model): - """Resource requests/limits for this instance type. +class NumericalDataDriftMetricThreshold(DataDriftMetricThresholdBase): + """NumericalDataDriftMetricThreshold. - :ivar requests: Resource requests for this instance type. - :vartype requests: dict[str, str] - :ivar limits: Resource limits for this instance type. - :vartype limits: dict[str, str] + All required parameters must be populated in order to send to server. + + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The numerical data drift metric to calculate. Required. Known values + are: "JensenShannonDistance", "PopulationStabilityIndex", "NormalizedWassersteinDistance", and + "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ + _validation = { + "data_type": {"required": True}, + "metric": {"required": True}, + } + _attribute_map = { - "requests": {"key": "requests", "type": "{str}"}, - "limits": {"key": "limits", "type": "{str}"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } def __init__( - self, *, requests: Optional[Dict[str, str]] = None, limits: Optional[Dict[str, str]] = None, **kwargs: Any + self, + *, + metric: Union[str, "_models.NumericalDataDriftMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any ) -> None: """ - :keyword requests: Resource requests for this instance type. - :paramtype requests: dict[str, str] - :keyword limits: Resource limits for this instance type. - :paramtype limits: dict[str, str] + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The numerical data drift metric to calculate. Required. Known + values are: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", and "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataDriftMetric """ - super().__init__(**kwargs) - self.requests = requests - self.limits = limits + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Numerical" + self.metric = metric -class JobBase(Resource): - """Azure Resource Manager resource envelope. - - 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. +class NumericalDataQualityMetricThreshold(DataQualityMetricThresholdBase): + """NumericalDataQualityMetricThreshold. - :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.JobBaseProperties + All required parameters must be populated in order to send to server. + + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The numerical data quality metric to calculate. Required. Known values + are: "NullValueRate", "DataTypeErrorRate", and "OutOfBoundsRate". + :vartype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"required": True}, + "data_type": {"required": True}, + "metric": {"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"}, - "properties": {"key": "properties", "type": "JobBaseProperties"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } - def __init__(self, *, properties: "_models.JobBaseProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + metric: Union[str, "_models.NumericalDataQualityMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The numerical data quality metric to calculate. Required. Known + values are: "NullValueRate", "DataTypeErrorRate", and "OutOfBoundsRate". + :paramtype metric: str or ~azure.mgmt.machinelearningservices.models.NumericalDataQualityMetric """ - super().__init__(**kwargs) - self.properties = properties + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Numerical" + self.metric = metric -class JobBaseResourceArmPaginatedResult(_serialization.Model): - """A paginated list of JobBase entities. +class NumericalPredictionDriftMetricThreshold(PredictionDriftMetricThresholdBase): + """NumericalPredictionDriftMetricThreshold. - :ivar next_link: The link to the next page of JobBase objects. If null, there are no additional - pages. - :vartype next_link: str - :ivar value: An array of objects of type JobBase. - :vartype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + All required parameters must be populated in order to send to server. + + :ivar data_type: [Required] Specifies the data type of the metric threshold. Required. Known + values are: "Numerical" and "Categorical". + :vartype data_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType + :ivar threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :vartype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :ivar metric: [Required] The numerical prediction drift metric to calculate. Required. Known + values are: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", and "TwoSampleKolmogorovSmirnovTest". + :vartype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ + _validation = { + "data_type": {"required": True}, + "metric": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[JobBase]"}, + "data_type": {"key": "dataType", "type": "str"}, + "threshold": {"key": "threshold", "type": "MonitoringThreshold"}, + "metric": {"key": "metric", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.JobBase"]] = None, **kwargs: Any + self, + *, + metric: Union[str, "_models.NumericalPredictionDriftMetric"], + threshold: Optional["_models.MonitoringThreshold"] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of JobBase objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type JobBase. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.JobBase] + :keyword threshold: The threshold value. If null, a default value will be set depending on the + selected metric. + :paramtype threshold: ~azure.mgmt.machinelearningservices.models.MonitoringThreshold + :keyword metric: [Required] The numerical prediction drift metric to calculate. Required. Known + values are: "JensenShannonDistance", "PopulationStabilityIndex", + "NormalizedWassersteinDistance", and "TwoSampleKolmogorovSmirnovTest". + :paramtype metric: str or + ~azure.mgmt.machinelearningservices.models.NumericalPredictionDriftMetric """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value + super().__init__(threshold=threshold, **kwargs) + self.data_type: str = "Numerical" + self.metric = metric -class JobResourceConfiguration(ResourceConfiguration): - """JobResourceConfiguration. +class OAuth2AuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """OAuth2AuthTypeWorkspaceConnectionProperties. - :ivar instance_count: Optional number of instances or nodes used by the compute target. - :vartype instance_count: int - :ivar instance_type: Optional type of VM used as supported by the compute target. - :vartype instance_type: str - :ivar properties: Additional properties bag. - :vartype properties: dict[str, JSON] - :ivar docker_args: Extra arguments to pass to the Docker run command. This would override any - parameters that have already been set by the system, or in this section. This parameter is only - supported for Azure ML compute types. - :vartype docker_args: str - :ivar shm_size: Size of the docker container's shared memory block. This should be in the - format of (number)(unit) where number as to be greater than 0 and the unit can be one of - b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). - :vartype shm_size: str + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ _validation = { - "shm_size": {"pattern": r"\d+[bBkKmMgG]"}, + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, } _attribute_map = { - "instance_count": {"key": "instanceCount", "type": "int"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "properties": {"key": "properties", "type": "{object}"}, - "docker_args": {"key": "dockerArgs", "type": "str"}, - "shm_size": {"key": "shmSize", "type": "str"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionOAuth2"}, } def __init__( self, *, - instance_count: int = 1, - instance_type: Optional[str] = None, - properties: Optional[Dict[str, JSON]] = None, - docker_args: Optional[str] = None, - shm_size: str = "2g", + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionOAuth2"] = None, **kwargs: Any ) -> None: """ - :keyword instance_count: Optional number of instances or nodes used by the compute target. - :paramtype instance_count: int - :keyword instance_type: Optional type of VM used as supported by the compute target. - :paramtype instance_type: str - :keyword properties: Additional properties bag. - :paramtype properties: dict[str, JSON] - :keyword docker_args: Extra arguments to pass to the Docker run command. This would override - any parameters that have already been set by the system, or in this section. This parameter is - only supported for Azure ML compute types. - :paramtype docker_args: str - :keyword shm_size: Size of the docker container's shared memory block. This should be in the - format of (number)(unit) where number as to be greater than 0 and the unit can be one of - b(bytes), k(kilobytes), m(megabytes), or g(gigabytes). - :paramtype shm_size: str + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionOAuth2 """ - super().__init__(instance_count=instance_count, instance_type=instance_type, properties=properties, **kwargs) - self.docker_args = docker_args - self.shm_size = shm_size + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "OAuth2" + self.credentials = credentials -class JobScheduleAction(ScheduleActionBase): - """JobScheduleAction. +class Objective(_serialization.Model): + """Optimization objective. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar action_type: [Required] Specifies the action type of the schedule. Required. Known values - are: "CreateJob" and "InvokeBatchEndpoint". - :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleActionType - :ivar job_definition: [Required] Defines Schedule action definition details. Required. - :vartype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :ivar goal: [Required] Defines supported metric goals for hyperparameter tuning. Required. + Known values are: "Minimize" and "Maximize". + :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :ivar primary_metric: [Required] Name of the metric to optimize. Required. + :vartype primary_metric: str """ _validation = { - "action_type": {"required": True}, - "job_definition": {"required": True}, + "goal": {"required": True}, + "primary_metric": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "action_type": {"key": "actionType", "type": "str"}, - "job_definition": {"key": "jobDefinition", "type": "JobBaseProperties"}, + "goal": {"key": "goal", "type": "str"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, } - def __init__(self, *, job_definition: "_models.JobBaseProperties", **kwargs: Any) -> None: + def __init__(self, *, goal: Union[str, "_models.Goal"], primary_metric: str, **kwargs: Any) -> None: """ - :keyword job_definition: [Required] Defines Schedule action definition details. Required. - :paramtype job_definition: ~azure.mgmt.machinelearningservices.models.JobBaseProperties + :keyword goal: [Required] Defines supported metric goals for hyperparameter tuning. Required. + Known values are: "Minimize" and "Maximize". + :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal + :keyword primary_metric: [Required] Name of the metric to optimize. Required. + :paramtype primary_metric: str """ super().__init__(**kwargs) - self.action_type: str = "CreateJob" - self.job_definition = job_definition + self.goal = goal + self.primary_metric = primary_metric -class JobService(_serialization.Model): - """Job endpoint definition. +class OneLakeDatastore(DatastoreProperties): + """OneLake (Trident) datastore configuration. Variables are only populated by the server, and will be ignored when sending a request. - :ivar endpoint: Url for endpoint. - :vartype endpoint: str - :ivar error_message: Any error in the service. - :vartype error_message: str - :ivar job_service_type: Endpoint type. - :vartype job_service_type: str - :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. - :vartype port: int - :ivar properties: Additional properties to set on the endpoint. + All required parameters must be populated in order to send to server. + + :ivar description: The asset description text. + :vartype description: str + :ivar properties: The asset property dictionary. :vartype properties: dict[str, str] - :ivar status: Status of endpoint. - :vartype status: 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 "OneLake". + :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 artifact: [Required] OneLake artifact backing the datastore. Required. + :vartype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :ivar endpoint: OneLake endpoint to use for the datastore. + :vartype endpoint: str + :ivar one_lake_workspace_name: [Required] OneLake workspace name. Required. + :vartype one_lake_workspace_name: 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 + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + + _validation = { + "credentials": {"required": True}, + "datastore_type": {"required": True}, + "is_default": {"readonly": True}, + "artifact": {"required": True}, + "one_lake_workspace_name": {"required": True, "min_length": 1, "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"}, + "artifact": {"key": "artifact", "type": "OneLakeArtifact"}, + "endpoint": {"key": "endpoint", "type": "str"}, + "one_lake_workspace_name": {"key": "oneLakeWorkspaceName", "type": "str"}, + "service_data_access_auth_identity": {"key": "serviceDataAccessAuthIdentity", "type": "str"}, + } + + def __init__( + self, + *, + credentials: "_models.DatastoreCredentials", + artifact: "_models.OneLakeArtifact", + one_lake_workspace_name: str, + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + endpoint: Optional[str] = None, + service_data_access_auth_identity: Optional[Union[str, "_models.ServiceDataAccessAuthIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :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 artifact: [Required] OneLake artifact backing the datastore. Required. + :paramtype artifact: ~azure.mgmt.machinelearningservices.models.OneLakeArtifact + :keyword endpoint: OneLake endpoint to use for the datastore. + :paramtype endpoint: str + :keyword one_lake_workspace_name: [Required] OneLake workspace name. Required. + :paramtype one_lake_workspace_name: 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". + :paramtype service_data_access_auth_identity: str or + ~azure.mgmt.machinelearningservices.models.ServiceDataAccessAuthIdentity + """ + super().__init__(description=description, properties=properties, tags=tags, credentials=credentials, **kwargs) + self.datastore_type: str = "OneLake" + self.artifact = artifact + self.endpoint = endpoint + self.one_lake_workspace_name = one_lake_workspace_name + self.service_data_access_auth_identity = service_data_access_auth_identity + + +class OnlineDeployment(TrackedResource): + """OnlineDeployment. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.OnlineDeploymentProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { - "error_message": {"readonly": True}, - "status": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, } _attribute_map = { - "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"}, + "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": "OnlineDeploymentProperties"}, + "sku": {"key": "sku", "type": "Sku"}, } def __init__( self, *, - 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, + location: str, + properties: "_models.OnlineDeploymentProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, **kwargs: Any ) -> None: """ - :keyword endpoint: Url for endpoint. - :paramtype endpoint: str - :keyword job_service_type: Endpoint type. - :paramtype job_service_type: str - :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. - :paramtype port: int - :keyword properties: Additional properties to set on the endpoint. - :paramtype properties: dict[str, str] + :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.OnlineDeploymentProperties + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku """ - super().__init__(**kwargs) - self.endpoint = endpoint - self.error_message = None - self.job_service_type = job_service_type - self.nodes = nodes - self.port = port + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind self.properties = properties - self.status = None + self.sku = sku -class KubernetesSchema(_serialization.Model): - """Kubernetes Compute Schema. +class OnlineDeploymentTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of OnlineDeployment entities. - :ivar properties: Properties of Kubernetes. - :vartype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineDeployment. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ _attribute_map = { - "properties": {"key": "properties", "type": "KubernetesProperties"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OnlineDeployment]"}, } - def __init__(self, *, properties: Optional["_models.KubernetesProperties"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.OnlineDeployment"]] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: Properties of Kubernetes. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties + :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineDeployment. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] """ super().__init__(**kwargs) - self.properties = properties + self.next_link = next_link + self.value = value -class Kubernetes(Compute, KubernetesSchema): # pylint: disable=too-many-instance-attributes - """A Machine Learning compute based on Kubernetes Compute. +class OnlineEndpoint(TrackedResource): + """OnlineEndpoint. 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. + All required parameters must be populated in order to send to server. - :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 - :ivar compute_location: Location for the underlying 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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar description: The description of the Machine Learning compute. - :vartype description: str - :ivar created_on: The time at which the compute was created. - :vartype created_on: ~datetime.datetime - :ivar modified_on: The time at which the compute was last modified. - :vartype modified_on: ~datetime.datetime - :ivar resource_id: ARM resource id of the underlying compute. - :vartype resource_id: str - :ivar provisioning_errors: Errors during provisioning. - :vartype provisioning_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] - :ivar is_attached_compute: Indicating whether the compute was provisioned by user and brought - from outside if true, or machine learning service provisioned it if false. - :vartype is_attached_compute: bool - :ivar disable_local_auth: Opt-out of local authentication and ensure customers can use only MSI - and AAD exclusively for authentication. - :vartype disable_local_auth: bool + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.OnlineEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { - "compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - "created_on": {"readonly": True}, - "modified_on": {"readonly": True}, - "provisioning_errors": {"readonly": True}, - "is_attached_compute": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, } _attribute_map = { - "properties": {"key": "properties", "type": "KubernetesProperties"}, - "compute_type": {"key": "computeType", "type": "str"}, - "compute_location": {"key": "computeLocation", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "created_on": {"key": "createdOn", "type": "iso-8601"}, - "modified_on": {"key": "modifiedOn", "type": "iso-8601"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "provisioning_errors": {"key": "provisioningErrors", "type": "[ErrorResponse]"}, - "is_attached_compute": {"key": "isAttachedCompute", "type": "bool"}, - "disable_local_auth": {"key": "disableLocalAuth", "type": "bool"}, + "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": "OnlineEndpointProperties"}, + "sku": {"key": "sku", "type": "Sku"}, } def __init__( self, *, - properties: Optional["_models.KubernetesProperties"] = None, - compute_location: Optional[str] = None, - description: Optional[str] = None, - resource_id: Optional[str] = None, - disable_local_auth: Optional[bool] = None, + location: str, + properties: "_models.OnlineEndpointProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, **kwargs: Any ) -> None: """ - :keyword properties: Properties of Kubernetes. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.KubernetesProperties - :keyword compute_location: Location for the underlying compute. - :paramtype compute_location: str - :keyword description: The description of the Machine Learning compute. - :paramtype description: str - :keyword resource_id: ARM resource id of the underlying compute. - :paramtype resource_id: str - :keyword disable_local_auth: Opt-out of local authentication and ensure customers can use only - MSI and AAD exclusively for authentication. - :paramtype disable_local_auth: bool - """ - super().__init__( - compute_location=compute_location, - description=description, - resource_id=resource_id, - disable_local_auth=disable_local_auth, - properties=properties, - **kwargs - ) - self.properties = properties - self.compute_type: str = "Kubernetes" - self.compute_location = compute_location - self.provisioning_state = None - self.description = description - self.created_on = None - self.modified_on = None - self.resource_id = resource_id - self.provisioning_errors = None - self.is_attached_compute = None - self.disable_local_auth = disable_local_auth - + :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.OnlineEndpointProperties + :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 OnlineDeploymentProperties(EndpointDeploymentPropertiesBase): # pylint: disable=too-many-instance-attributes - """OnlineDeploymentProperties. - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - KubernetesOnlineDeployment, ManagedOnlineDeployment +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. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar code_configuration: Code configuration for the endpoint deployment. - :vartype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :ivar description: Description of the endpoint deployment. + :ivar auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure + Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. + Required. Known values are: "AMLToken", "Key", and "AADToken". + :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :ivar description: Description of the inference endpoint. :vartype description: str - :ivar environment_id: ARM resource ID or AssetId 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] + :ivar keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :ivar properties: Property dictionary. Properties can be added, but not removed or altered. :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known - values are: "Managed", "Kubernetes", and "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: - "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". + :ivar scoring_uri: Endpoint URI. + :vartype scoring_uri: str + :ivar swagger_uri: Endpoint Swagger URI. + :vartype swagger_uri: str + :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 - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState + :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access + when Private Link is enabled. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values + need to sum to 100. + :vartype traffic: dict[str, int] """ _validation = { - "endpoint_compute_type": {"required": True}, + "auth_mode": {"required": True}, + "scoring_uri": {"readonly": True}, + "swagger_uri": {"readonly": True}, "provisioning_state": {"readonly": True}, } _attribute_map = { - "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, + "auth_mode": {"key": "authMode", "type": "str"}, "description": {"key": "description", "type": "str"}, - "environment_id": {"key": "environmentId", "type": "str"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, + "keys": {"key": "keys", "type": "EndpointAuthKeys"}, "properties": {"key": "properties", "type": "{str}"}, - "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, - "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, - "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, - "model": {"key": "model", "type": "str"}, - "model_mount_path": {"key": "modelMountPath", "type": "str"}, + "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"}, - "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, - "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, - "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, - } - - _subtype_map = { - "endpoint_compute_type": {"Kubernetes": "KubernetesOnlineDeployment", "Managed": "ManagedOnlineDeployment"} + "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, + "traffic": {"key": "traffic", "type": "{int}"}, } def __init__( self, *, - code_configuration: Optional["_models.CodeConfiguration"] = None, + auth_mode: Union[str, "_models.EndpointAuthMode"], description: Optional[str] = None, - environment_id: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, + keys: Optional["_models.EndpointAuthKeys"] = None, properties: Optional[Dict[str, str]] = None, - app_insights_enabled: bool = False, - egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, - instance_type: Optional[str] = None, - liveness_probe: Optional["_models.ProbeSettings"] = None, - model: Optional[str] = None, - model_mount_path: Optional[str] = None, - readiness_probe: Optional["_models.ProbeSettings"] = None, - request_settings: Optional["_models.OnlineRequestSettings"] = None, - scale_settings: Optional["_models.OnlineScaleSettings"] = 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: Any ) -> None: """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :paramtype code_configuration: ~azure.mgmt.machinelearningservices.models.CodeConfiguration - :keyword description: Description of the endpoint deployment. + :keyword auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure + Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. + Required. Known values are: "AMLToken", "Key", and "AADToken". + :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode + :keyword description: Description of the inference endpoint. :paramtype description: str - :keyword environment_id: ARM resource ID or AssetId 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] + :keyword keys: EndpointAuthKeys to set initially on an Endpoint. + This property will always be returned as null. AuthKey values must be retrieved using the + ListKeys API. + :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :keyword properties: Property dictionary. Properties can be added, but not removed or altered. :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - """ - super().__init__( - code_configuration=code_configuration, - description=description, - environment_id=environment_id, - environment_variables=environment_variables, - properties=properties, - **kwargs - ) - self.app_insights_enabled = app_insights_enabled - self.egress_public_network_access = egress_public_network_access - self.endpoint_compute_type: Optional[str] = None - self.instance_type = instance_type - self.liveness_probe = liveness_probe - self.model = model - self.model_mount_path = model_mount_path - self.provisioning_state = None - self.readiness_probe = readiness_probe - self.request_settings = request_settings - self.scale_settings = scale_settings - - -class KubernetesOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=too-many-instance-attributes - """Properties specific to a KubernetesOnlineDeployment. - - 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 code_configuration: Code configuration for the endpoint deployment. - :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. - :vartype environment_id: str - :ivar environment_variables: Environment variables configuration for the deployment. - :vartype environment_variables: dict[str, str] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known - values are: "Managed", "Kubernetes", and "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: - "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - :ivar container_resource_requirements: The resource requirements for the container (cpu and - memory). - :vartype container_resource_requirements: - ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + :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 + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic + values need to sum to 100. + :paramtype traffic: dict[str, int] + """ + 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 + + +class OnlineEndpointTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of OnlineEndpoint entities. + + :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type OnlineEndpoint. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] """ - _validation = { - "endpoint_compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OnlineEndpoint]"}, } + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.OnlineEndpoint"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type OnlineEndpoint. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class OnlineRequestSettings(_serialization.Model): + """Online deployment scoring requests configuration. + + :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node + allowed per deployment. Defaults to 1. + :vartype max_concurrent_requests_per_instance: int + :ivar max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :vartype max_queue_wait: ~datetime.timedelta + :ivar request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :vartype request_timeout: ~datetime.timedelta + """ + _attribute_map = { - "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, - "description": {"key": "description", "type": "str"}, - "environment_id": {"key": "environmentId", "type": "str"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "properties": {"key": "properties", "type": "{str}"}, - "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, - "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, - "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, - "model": {"key": "model", "type": "str"}, - "model_mount_path": {"key": "modelMountPath", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, - "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, - "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, - "container_resource_requirements": { - "key": "containerResourceRequirements", - "type": "ContainerResourceRequirements", - }, + "max_concurrent_requests_per_instance": {"key": "maxConcurrentRequestsPerInstance", "type": "int"}, + "max_queue_wait": {"key": "maxQueueWait", "type": "duration"}, + "request_timeout": {"key": "requestTimeout", "type": "duration"}, } def __init__( self, *, - code_configuration: Optional["_models.CodeConfiguration"] = None, - description: Optional[str] = None, - environment_id: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - properties: Optional[Dict[str, str]] = None, - app_insights_enabled: bool = False, - egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, - instance_type: Optional[str] = None, - liveness_probe: Optional["_models.ProbeSettings"] = None, - model: Optional[str] = None, - model_mount_path: Optional[str] = None, - readiness_probe: Optional["_models.ProbeSettings"] = None, - request_settings: Optional["_models.OnlineRequestSettings"] = None, - scale_settings: Optional["_models.OnlineScaleSettings"] = None, - container_resource_requirements: Optional["_models.ContainerResourceRequirements"] = None, + max_concurrent_requests_per_instance: int = 1, + max_queue_wait: datetime.timedelta = "PT0.5S", + request_timeout: datetime.timedelta = "PT5S", **kwargs: Any ) -> None: """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :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. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - :keyword container_resource_requirements: The resource requirements for the container (cpu and - memory). - :paramtype container_resource_requirements: - ~azure.mgmt.machinelearningservices.models.ContainerResourceRequirements + :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per + node allowed per deployment. Defaults to 1. + :paramtype max_concurrent_requests_per_instance: int + :keyword max_queue_wait: (Deprecated for Managed Online Endpoints) The maximum amount of time a + request will stay in the queue in ISO 8601 format. + Defaults to 500ms. + (Now increase ``request_timeout_ms`` to account for any networking/queue delays). + :paramtype max_queue_wait: ~datetime.timedelta + :keyword request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :paramtype request_timeout: ~datetime.timedelta """ - super().__init__( - code_configuration=code_configuration, - description=description, - environment_id=environment_id, - environment_variables=environment_variables, - properties=properties, - app_insights_enabled=app_insights_enabled, - egress_public_network_access=egress_public_network_access, - instance_type=instance_type, - liveness_probe=liveness_probe, - model=model, - model_mount_path=model_mount_path, - readiness_probe=readiness_probe, - request_settings=request_settings, - scale_settings=scale_settings, - **kwargs - ) - self.endpoint_compute_type: str = "Kubernetes" - self.container_resource_requirements = container_resource_requirements + super().__init__(**kwargs) + self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance + self.max_queue_wait = max_queue_wait + self.request_timeout = request_timeout -class KubernetesProperties(_serialization.Model): - """Kubernetes properties. +class OpenAIEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): # pylint: disable=name-too-long + """OpenAIEndpointDeploymentResourceProperties. - :ivar relay_connection_string: Relay connection string. - :vartype relay_connection_string: str - :ivar service_bus_connection_string: ServiceBus connection string. - :vartype service_bus_connection_string: str - :ivar extension_principal_id: Extension principal-id. - :vartype extension_principal_id: str - :ivar extension_instance_release_train: Extension instance release train. - :vartype extension_instance_release_train: str - :ivar vc_name: VC name. - :vartype vc_name: str - :ivar namespace: Compute namespace. - :vartype namespace: str - :ivar default_instance_type: Default instance type. - :vartype default_instance_type: str - :ivar instance_types: Instance Type Schema. - :vartype instance_types: dict[str, - ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + 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 server. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str + :ivar model: Model used for the endpoint deployment. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar sku: + :vartype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :ivar version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ + _validation = { + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "model": {"required": True}, + } + _attribute_map = { - "relay_connection_string": {"key": "relayConnectionString", "type": "str"}, - "service_bus_connection_string": {"key": "serviceBusConnectionString", "type": "str"}, - "extension_principal_id": {"key": "extensionPrincipalId", "type": "str"}, - "extension_instance_release_train": {"key": "extensionInstanceReleaseTrain", "type": "str"}, - "vc_name": {"key": "vcName", "type": "str"}, - "namespace": {"key": "namespace", "type": "str"}, - "default_instance_type": {"key": "defaultInstanceType", "type": "str"}, - "instance_types": {"key": "instanceTypes", "type": "{InstanceTypeSchema}"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "model": {"key": "model", "type": "EndpointDeploymentModel"}, + "rai_policy_name": {"key": "raiPolicyName", "type": "str"}, + "sku": {"key": "sku", "type": "CognitiveServicesSku"}, + "version_upgrade_option": {"key": "versionUpgradeOption", "type": "str"}, } def __init__( self, *, - relay_connection_string: Optional[str] = None, - service_bus_connection_string: Optional[str] = None, - extension_principal_id: Optional[str] = None, - extension_instance_release_train: Optional[str] = None, - vc_name: Optional[str] = None, - namespace: str = "default", - default_instance_type: Optional[str] = None, - instance_types: Optional[Dict[str, "_models.InstanceTypeSchema"]] = None, + model: "_models.EndpointDeploymentModel", + failure_reason: Optional[str] = None, + rai_policy_name: Optional[str] = None, + sku: Optional["_models.CognitiveServicesSku"] = None, + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, **kwargs: Any ) -> None: """ - :keyword relay_connection_string: Relay connection string. - :paramtype relay_connection_string: str - :keyword service_bus_connection_string: ServiceBus connection string. - :paramtype service_bus_connection_string: str - :keyword extension_principal_id: Extension principal-id. - :paramtype extension_principal_id: str - :keyword extension_instance_release_train: Extension instance release train. - :paramtype extension_instance_release_train: str - :keyword vc_name: VC name. - :paramtype vc_name: str - :keyword namespace: Compute namespace. - :paramtype namespace: str - :keyword default_instance_type: Default instance type. - :paramtype default_instance_type: str - :keyword instance_types: Instance Type Schema. - :paramtype instance_types: dict[str, - ~azure.mgmt.machinelearningservices.models.InstanceTypeSchema] + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword model: Model used for the endpoint deployment. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword sku: + :paramtype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :keyword version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ - super().__init__(**kwargs) - self.relay_connection_string = relay_connection_string - self.service_bus_connection_string = service_bus_connection_string - self.extension_principal_id = extension_principal_id - self.extension_instance_release_train = extension_instance_release_train - self.vc_name = vc_name - self.namespace = namespace - self.default_instance_type = default_instance_type - self.instance_types = instance_types + super().__init__( + model=model, + rai_policy_name=rai_policy_name, + sku=sku, + version_upgrade_option=version_upgrade_option, + failure_reason=failure_reason, + **kwargs + ) + self.failure_reason = failure_reason + self.provisioning_state = None + self.type: str = "Azure.OpenAI" + self.model = model + self.rai_policy_name = rai_policy_name + self.sku = sku + self.version_upgrade_option = version_upgrade_option -class ListAmlUserFeatureResult(_serialization.Model): - """The List Aml user feature operation response. +class OpenAIEndpointResourceProperties(EndpointResourceProperties): + """OpenAIEndpointResourceProperties. 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 + All required parameters must be populated in order to send to server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[AmlUserFeature]"}, - "next_link": {"key": "nextLink", "type": "str"}, + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + """ + super().__init__( + associated_resource_id=associated_resource_id, + deployments=deployments, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + location=location, + name=name, + should_create_ai_services_endpoint=should_create_ai_services_endpoint, + **kwargs + ) + self.endpoint_type: str = "Azure.OpenAI" -class ListNotebookKeysResult(_serialization.Model): - """ListNotebookKeysResult. +class Operation(_serialization.Model): + """Details of a REST API operation, returned from the Resource Provider Operations API. 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 + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for ARM/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.machinelearningservices.models.Origin + :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for + internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.machinelearningservices.models.ActionType """ _validation = { - "primary_access_key": {"readonly": True}, - "secondary_access_key": {"readonly": True}, + "name": {"readonly": True}, + "is_data_action": {"readonly": True}, + "origin": {"readonly": True}, + "action_type": {"readonly": True}, } _attribute_map = { - "primary_access_key": {"key": "primaryAccessKey", "type": "str"}, - "secondary_access_key": {"key": "secondaryAccessKey", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "is_data_action": {"key": "isDataAction", "type": "bool"}, + "display": {"key": "display", "type": "OperationDisplay"}, + "origin": {"key": "origin", "type": "str"}, + "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.machinelearningservices.models.OperationDisplay + """ super().__init__(**kwargs) - self.primary_access_key = None - self.secondary_access_key = None + self.name = None + self.is_data_action = None + self.display = display + self.origin = None + self.action_type = None -class ListStorageAccountKeysResult(_serialization.Model): - """ListStorageAccountKeysResult. +class OperationDisplay(_serialization.Model): + """Localized display information for this particular operation. Variables are only populated by the server, and will be ignored when sending a request. - :ivar user_storage_key: - :vartype user_storage_key: str + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str """ _validation = { - "user_storage_key": {"readonly": True}, + "provider": {"readonly": True}, + "resource": {"readonly": True}, + "operation": {"readonly": True}, + "description": {"readonly": True}, } _attribute_map = { - "user_storage_key": {"key": "userStorageKey", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.user_storage_key = None + self.provider = None + self.resource = None + self.operation = None + self.description = None -class ListUsagesResult(_serialization.Model): - """The List Usages operation response. +class OperationListResult(_serialization.Model): + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. 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. + :ivar value: List of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Operation] + :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -14161,7 +25115,7 @@ class ListUsagesResult(_serialization.Model): } _attribute_map = { - "value": {"key": "value", "type": "[Usage]"}, + "value": {"key": "value", "type": "[Operation]"}, "next_link": {"key": "nextLink", "type": "str"}, } @@ -14172,946 +25126,924 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class ListWorkspaceKeysResult(_serialization.Model): - """ListWorkspaceKeysResult. - - Variables are only populated by the server, and will be ignored when sending a request. +class OsPatchingStatus(_serialization.Model): + """Returns metadata about the os patching. - :ivar user_storage_key: - :vartype user_storage_key: str - :ivar user_storage_resource_id: - :vartype user_storage_resource_id: str - :ivar app_insights_instrumentation_key: - :vartype app_insights_instrumentation_key: str - :ivar container_registry_credentials: - :vartype container_registry_credentials: - ~azure.mgmt.machinelearningservices.models.RegistryListCredentialsResult - :ivar notebook_access_keys: - :vartype notebook_access_keys: - ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult + :ivar patch_status: The os patching status. Known values are: "CompletedWithWarnings", + "Failed", "InProgress", "Succeeded", and "Unknown". + :vartype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :ivar latest_patch_time: Time of the latest os patching. + :vartype latest_patch_time: str + :ivar reboot_pending: Specifies whether this compute instance is pending for reboot to finish + os patching. + :vartype reboot_pending: bool + :ivar scheduled_reboot_time: Time of scheduled reboot. + :vartype scheduled_reboot_time: str + :ivar os_patching_errors: Collection of errors encountered when doing os patching. + :vartype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] """ - _validation = { - "user_storage_key": {"readonly": True}, - "user_storage_resource_id": {"readonly": True}, - "app_insights_instrumentation_key": {"readonly": True}, - "container_registry_credentials": {"readonly": True}, - "notebook_access_keys": {"readonly": True}, - } - _attribute_map = { - "user_storage_key": {"key": "userStorageKey", "type": "str"}, - "user_storage_resource_id": {"key": "userStorageResourceId", "type": "str"}, - "app_insights_instrumentation_key": {"key": "appInsightsInstrumentationKey", "type": "str"}, - "container_registry_credentials": { - "key": "containerRegistryCredentials", - "type": "RegistryListCredentialsResult", - }, - "notebook_access_keys": {"key": "notebookAccessKeys", "type": "ListNotebookKeysResult"}, + "patch_status": {"key": "patchStatus", "type": "str"}, + "latest_patch_time": {"key": "latestPatchTime", "type": "str"}, + "reboot_pending": {"key": "rebootPending", "type": "bool"}, + "scheduled_reboot_time": {"key": "scheduledRebootTime", "type": "str"}, + "os_patching_errors": {"key": "osPatchingErrors", "type": "[ErrorResponse]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + patch_status: Optional[Union[str, "_models.PatchStatus"]] = None, + latest_patch_time: Optional[str] = None, + reboot_pending: Optional[bool] = None, + scheduled_reboot_time: Optional[str] = None, + os_patching_errors: Optional[List["_models.ErrorResponse"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword patch_status: The os patching status. Known values are: "CompletedWithWarnings", + "Failed", "InProgress", "Succeeded", and "Unknown". + :paramtype patch_status: str or ~azure.mgmt.machinelearningservices.models.PatchStatus + :keyword latest_patch_time: Time of the latest os patching. + :paramtype latest_patch_time: str + :keyword reboot_pending: Specifies whether this compute instance is pending for reboot to + finish os patching. + :paramtype reboot_pending: bool + :keyword scheduled_reboot_time: Time of scheduled reboot. + :paramtype scheduled_reboot_time: str + :keyword os_patching_errors: Collection of errors encountered when doing os patching. + :paramtype os_patching_errors: list[~azure.mgmt.machinelearningservices.models.ErrorResponse] + """ super().__init__(**kwargs) - self.user_storage_key = None - self.user_storage_resource_id = None - self.app_insights_instrumentation_key = None - self.container_registry_credentials = None - self.notebook_access_keys = None + self.patch_status = patch_status + self.latest_patch_time = latest_patch_time + self.reboot_pending = reboot_pending + self.scheduled_reboot_time = scheduled_reboot_time + self.os_patching_errors = os_patching_errors -class ListWorkspaceQuotas(_serialization.Model): - """The List WorkspaceQuotasByVMFamily operation response. +class OutboundRuleBasicResource(Resource): + """OutboundRuleBasicResource. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Workspace Quotas by VM Family. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ResourceQuota] - :ivar next_link: The URI to fetch the next page of workspace quota information by VM Family. - Call ListNext() with this to fetch the next page of Workspace Quota information. - :vartype next_link: str + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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: Outbound Rule for the managed network of a machine learning workspace. + Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule """ _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "[ResourceQuota]"}, - "next_link": {"key": "nextLink", "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": "OutboundRule"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, properties: "_models.OutboundRule", **kwargs: Any) -> None: + """ + :keyword properties: Outbound Rule for the managed network of a machine learning workspace. + Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.OutboundRule + """ super().__init__(**kwargs) - self.value = None - self.next_link = None - + self.properties = properties -class LiteralJobInput(JobInput): - """Literal input type. - All required parameters must be populated in order to send to Azure. +class OutboundRuleListResult(_serialization.Model): + """List of outbound rules for the managed network of a machine learning workspace. - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and - "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar value: [Required] Literal value for the input. Required. - :vartype value: str + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str + :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :vartype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ - _validation = { - "job_input_type": {"required": True}, - "value": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - "value": {"key": "value", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[OutboundRuleBasicResource]"}, } - def __init__(self, *, value: str, description: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.OutboundRuleBasicResource"]] = None, + **kwargs: Any + ) -> None: """ - :keyword description: Description for the input. - :paramtype description: str - :keyword value: [Required] Literal value for the input. Required. - :paramtype value: str + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str + :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the + nextLink field should be used to request the next list of machine learning workspaces. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] """ - super().__init__(description=description, **kwargs) - self.job_input_type: str = "literal" + super().__init__(**kwargs) + self.next_link = next_link self.value = value -class ManagedIdentity(IdentityConfiguration): - """Managed identity configuration. +class OutputPathAssetReference(AssetReferenceBase): + """Reference to an asset via its path in a job output. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar identity_type: [Required] Specifies the type of identity framework. Required. Known - values are: "Managed", "AMLToken", and "UserIdentity". - :vartype identity_type: str or - ~azure.mgmt.machinelearningservices.models.IdentityConfigurationType - :ivar client_id: Specifies a user-assigned identity by client ID. For system-assigned, do not - set this field. - :vartype client_id: str - :ivar object_id: Specifies a user-assigned identity by object ID. For system-assigned, do not - set this field. - :vartype object_id: str - :ivar resource_id: Specifies a user-assigned identity by ARM resource ID. For system-assigned, - do not set this field. - :vartype resource_id: str + :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values + are: "Id", "DataPath", and "OutputPath". + :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType + :ivar job_id: ARM resource ID of the job. + :vartype job_id: str + :ivar path: The path of the file/directory in the job output. + :vartype path: str """ _validation = { - "identity_type": {"required": True}, + "reference_type": {"required": True}, } _attribute_map = { - "identity_type": {"key": "identityType", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, + "reference_type": {"key": "referenceType", "type": "str"}, + "job_id": {"key": "jobId", "type": "str"}, + "path": {"key": "path", "type": "str"}, } - def __init__( - self, - *, - client_id: Optional[str] = None, - object_id: Optional[str] = None, - resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, job_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: """ - :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 + :keyword job_id: ARM resource ID of the job. + :paramtype job_id: str + :keyword path: The path of the file/directory in the job output. + :paramtype path: 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. + self.reference_type: str = "OutputPath" + self.job_id = job_id + self.path = path - 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. +class PaginatedComputeResourcesList(_serialization.Model): + """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. - :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 + :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. + :vartype next_link: str """ - _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", - } + "value": {"key": "value", "type": "[ComputeResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, } 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: Any + self, *, value: Optional[List["_models.ComputeResource"]] = None, next_link: Optional[str] = None, **kwargs: Any ) -> None: """ - :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 + :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] + :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. + :paramtype next_link: 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.next_link = next_link -class ManagedIdentityAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """ManagedIdentityAuthTypeWorkspaceConnectionProperties. - All required parameters must be populated in order to send to Azure. +class PartialBatchDeployment(_serialization.Model): + """Mutable batch inference settings per deployment. - :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 - :ivar credentials: - :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + :ivar description: Description of the endpoint deployment. + :vartype description: str """ - _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": "WorkspaceConnectionManagedIdentity"}, + "description": {"key": "description", "type": "str"}, } - 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.WorkspaceConnectionManagedIdentity"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ - :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 - :keyword credentials: - :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionManagedIdentity + :keyword description: Description of the endpoint deployment. + :paramtype description: str """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "ManagedIdentity" - self.credentials = credentials - - -class ManagedOnlineDeployment(OnlineDeploymentProperties): # pylint: disable=too-many-instance-attributes - """Properties specific to a ManagedOnlineDeployment. + super().__init__(**kwargs) + self.description = description - 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. +class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties( + _serialization.Model +): # pylint: disable=name-too-long + """Strictly used in update requests. - :ivar code_configuration: Code configuration for the endpoint deployment. - :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. - :vartype environment_id: str - :ivar environment_variables: Environment variables configuration for the deployment. - :vartype environment_variables: dict[str, str] - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar app_insights_enabled: If true, enables Application Insights logging. - :vartype app_insights_enabled: bool - :ivar egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :vartype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :ivar endpoint_compute_type: [Required] The compute type of the endpoint. Required. Known - values are: "Managed", "Kubernetes", and "AzureMLCompute". - :vartype endpoint_compute_type: str or - ~azure.mgmt.machinelearningservices.models.EndpointComputeType - :ivar instance_type: Compute instance type. - :vartype instance_type: str - :ivar liveness_probe: Liveness probe monitors the health of the container regularly. - :vartype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar model: The URI path to the model. - :vartype model: str - :ivar model_mount_path: The path to mount the model in custom container. - :vartype model_mount_path: str - :ivar provisioning_state: Provisioning state for the endpoint deployment. Known values are: - "Creating", "Deleting", "Scaling", "Updating", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.DeploymentProvisioningState - :ivar readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :vartype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :ivar request_settings: Request settings for the deployment. - :vartype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :ivar scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings + :ivar properties: Additional attributes of the entity. + :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - "endpoint_compute_type": {"required": True}, - "provisioning_state": {"readonly": True}, - } - _attribute_map = { - "code_configuration": {"key": "codeConfiguration", "type": "CodeConfiguration"}, - "description": {"key": "description", "type": "str"}, - "environment_id": {"key": "environmentId", "type": "str"}, - "environment_variables": {"key": "environmentVariables", "type": "{str}"}, - "properties": {"key": "properties", "type": "{str}"}, - "app_insights_enabled": {"key": "appInsightsEnabled", "type": "bool"}, - "egress_public_network_access": {"key": "egressPublicNetworkAccess", "type": "str"}, - "endpoint_compute_type": {"key": "endpointComputeType", "type": "str"}, - "instance_type": {"key": "instanceType", "type": "str"}, - "liveness_probe": {"key": "livenessProbe", "type": "ProbeSettings"}, - "model": {"key": "model", "type": "str"}, - "model_mount_path": {"key": "modelMountPath", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "readiness_probe": {"key": "readinessProbe", "type": "ProbeSettings"}, - "request_settings": {"key": "requestSettings", "type": "OnlineRequestSettings"}, - "scale_settings": {"key": "scaleSettings", "type": "OnlineScaleSettings"}, + "properties": {"key": "properties", "type": "PartialBatchDeployment"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - code_configuration: Optional["_models.CodeConfiguration"] = None, - description: Optional[str] = None, - environment_id: Optional[str] = None, - environment_variables: Optional[Dict[str, str]] = None, - properties: Optional[Dict[str, str]] = None, - app_insights_enabled: bool = False, - egress_public_network_access: Optional[Union[str, "_models.EgressPublicNetworkAccessType"]] = None, - instance_type: Optional[str] = None, - liveness_probe: Optional["_models.ProbeSettings"] = None, - model: Optional[str] = None, - model_mount_path: Optional[str] = None, - readiness_probe: Optional["_models.ProbeSettings"] = None, - request_settings: Optional["_models.OnlineRequestSettings"] = None, - scale_settings: Optional["_models.OnlineScaleSettings"] = None, + properties: Optional["_models.PartialBatchDeployment"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs: Any ) -> None: """ - :keyword code_configuration: Code configuration for the endpoint deployment. - :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. - :paramtype environment_id: str - :keyword environment_variables: Environment variables configuration for the deployment. - :paramtype environment_variables: dict[str, str] - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :keyword app_insights_enabled: If true, enables Application Insights logging. - :paramtype app_insights_enabled: bool - :keyword egress_public_network_access: If Enabled, allow egress public network access. If - Disabled, this will create secure egress. Default: Enabled. Known values are: "Enabled" and - "Disabled". - :paramtype egress_public_network_access: str or - ~azure.mgmt.machinelearningservices.models.EgressPublicNetworkAccessType - :keyword instance_type: Compute instance type. - :paramtype instance_type: str - :keyword liveness_probe: Liveness probe monitors the health of the container regularly. - :paramtype liveness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword model: The URI path to the model. - :paramtype model: str - :keyword model_mount_path: The path to mount the model in custom container. - :paramtype model_mount_path: str - :keyword readiness_probe: Readiness probe validates if the container is ready to serve traffic. - The properties and defaults are the same as liveness probe. - :paramtype readiness_probe: ~azure.mgmt.machinelearningservices.models.ProbeSettings - :keyword request_settings: Request settings for the deployment. - :paramtype request_settings: ~azure.mgmt.machinelearningservices.models.OnlineRequestSettings - :keyword scale_settings: Scale settings for the deployment. - If it is null or not provided, - it defaults to TargetUtilizationScaleSettings for KubernetesOnlineDeployment - and to DefaultScaleSettings for ManagedOnlineDeployment. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.OnlineScaleSettings - """ - super().__init__( - code_configuration=code_configuration, - description=description, - environment_id=environment_id, - environment_variables=environment_variables, - properties=properties, - app_insights_enabled=app_insights_enabled, - egress_public_network_access=egress_public_network_access, - instance_type=instance_type, - liveness_probe=liveness_probe, - model=model, - model_mount_path=model_mount_path, - readiness_probe=readiness_probe, - request_settings=request_settings, - scale_settings=scale_settings, - **kwargs - ) - self.endpoint_compute_type: str = "Managed" + :keyword properties: Additional attributes of the entity. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.properties = properties + self.tags = tags -class ManagedServiceIdentity(_serialization.Model): +class PartialManagedServiceIdentity(_serialization.Model): """Managed service identity (system assigned and/or user assigned identities). - 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 principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". + :ivar type: Managed service identity (system assigned and/or user assigned identities). Known + values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :vartype user_assigned_identities: dict[str, JSON] """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{object}"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, JSON]] = None, **kwargs: Any ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". + :keyword type: Managed service identity (system assigned and/or user assigned identities). + Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :paramtype user_assigned_identities: dict[str, JSON] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None self.type = type self.user_assigned_identities = user_assigned_identities -class MedianStoppingPolicy(EarlyTerminationPolicy): - """Defines an early termination policy based on running averages of the primary metric of all - runs. - - All required parameters must be populated in order to send to Azure. +class PartialMinimalTrackedResource(_serialization.Model): + """Strictly used in update requests. - :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. - :vartype delay_evaluation: int - :ivar evaluation_interval: Interval (number of runs) between policy evaluations. - :vartype evaluation_interval: int - :ivar policy_type: [Required] Name of policy configuration. Required. Known values are: - "Bandit", "MedianStopping", and "TruncationSelection". - :vartype policy_type: str or - ~azure.mgmt.machinelearningservices.models.EarlyTerminationPolicyType + :ivar tags: Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - "policy_type": {"required": True}, + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, } + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): # pylint: disable=name-too-long + """Strictly used in update requests. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + """ + _attribute_map = { - "delay_evaluation": {"key": "delayEvaluation", "type": "int"}, - "evaluation_interval": {"key": "evaluationInterval", "type": "int"}, - "policy_type": {"key": "policyType", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, } - def __init__(self, *, delay_evaluation: int = 0, evaluation_interval: int = 0, **kwargs: Any) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.PartialManagedServiceIdentity"] = None, + **kwargs: Any + ) -> None: """ - :keyword delay_evaluation: Number of intervals by which to delay the first evaluation. - :paramtype delay_evaluation: int - :keyword evaluation_interval: Interval (number of runs) between policy evaluations. - :paramtype evaluation_interval: int + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity """ - super().__init__(delay_evaluation=delay_evaluation, evaluation_interval=evaluation_interval, **kwargs) - self.policy_type: str = "MedianStopping" + super().__init__(tags=tags, **kwargs) + self.identity = identity -class MLFlowModelJobInput(AssetJobInput, JobInput): - """MLFlowModelJobInput. +class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): + """Strictly used in update requests. - All required parameters must be populated in order to send to Azure. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + """ - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and - "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: [Required] Input Asset URI. Required. - :vartype uri: str + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "sku": {"key": "sku", "type": "PartialSku"}, + } + + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.PartialSku"] = None, **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + """ + super().__init__(tags=tags, **kwargs) + self.sku = sku + + +class PartialMinimalTrackedResourceWithSkuAndIdentity(PartialMinimalTrackedResource): # pylint: disable=name-too-long + """Strictly used in update requests. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku """ - _validation = { - "job_input_type": {"required": True}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "PartialSku"}, } + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.PartialManagedServiceIdentity"] = None, + sku: Optional["_models.PartialSku"] = None, + **kwargs: Any + ) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + """ + super().__init__(tags=tags, **kwargs) + self.identity = identity + 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.RegistryPartialManagedServiceIdentity + :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 = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "identity": {"key": "identity", "type": "RegistryPartialManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "PartialSku"}, + "tags": {"key": "tags", "type": "{str}"}, } def __init__( self, *, - uri: str, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + identity: Optional["_models.RegistryPartialManagedServiceIdentity"] = None, + sku: Optional["_models.PartialSku"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: + ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity + :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.sku = sku + self.tags = tags + + +class PartialSku(_serialization.Model): + """Common SKU definition. + + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + """ + + _attribute_map = { + "capacity": {"key": "capacity", "type": "int"}, + "family": {"key": "family", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + } + + def __init__( + self, + *, + capacity: Optional[int] = None, + family: Optional[str] = None, + name: Optional[str] = None, + size: Optional[str] = None, + tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any ) -> None: """ - :keyword description: Description for the input. - :paramtype description: str - :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: [Required] Input Asset URI. Required. - :paramtype uri: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) - self.description = description - self.job_input_type: str = "mlflow_model" - self.mode = mode - self.uri = uri + super().__init__(**kwargs) + self.capacity = capacity + self.family = family + self.name = name + self.size = size + self.tier = tier -class MLFlowModelJobOutput(AssetJobOutput, JobOutput): - """MLFlowModelJobOutput. +class Password(_serialization.Model): + """Password. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar description: Description for the output. - :vartype description: str - :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". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str + :ivar name: + :vartype name: str + :ivar value: + :vartype value: str """ _validation = { - "job_output_type": {"required": True}, + "name": {"readonly": True}, + "value": {"readonly": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "value": {"key": "value", "type": "str"}, } - def __init__( - self, - *, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, - uri: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword description: Description for the output. - :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". - :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) - self.description = description - self.job_output_type: str = "mlflow_model" - self.mode = mode - self.uri = uri + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.name = None + self.value = None -class MLTableData(DataVersionBaseProperties): - """MLTable data definition. +class PATAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes + """PATAuthTypeWorkspaceConnectionProperties. - All required parameters must be populated in order to send to Azure. + 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. - :vartype properties: dict[str, str] - :ivar tags: Tag dictionary. Tags can be added, removed, and updated. - :vartype tags: dict[str, str] - :ivar is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :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. 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] + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ _validation = { - "data_type": {"required": True}, - "data_uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_anonymous": {"key": "isAnonymous", "type": "bool"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "data_type": {"key": "dataType", "type": "str"}, - "data_uri": {"key": "dataUri", "type": "str"}, - "referenced_uris": {"key": "referencedUris", "type": "[str]"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionPersonalAccessToken"}, } def __init__( self, *, - data_uri: str, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: bool = False, - is_archived: bool = False, - referenced_uris: Optional[List[str]] = None, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionPersonalAccessToken"] = None, **kwargs: Any ) -> None: """ - :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 is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :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] + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken """ super().__init__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, - data_uri=data_uri, + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, **kwargs ) - self.data_type: str = "mltable" - self.referenced_uris = referenced_uris + self.auth_type: str = "PAT" + self.credentials = credentials -class MLTableJobInput(AssetJobInput, JobInput): - """MLTableJobInput. +class PendingUploadCredentialDto(_serialization.Model): + """PendingUploadCredentialDto. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SASCredentialDto - :ivar description: Description for the input. - :vartype description: str - :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: - "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and - "triton_model". - :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType - :ivar mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :ivar uri: [Required] Input Asset URI. Required. - :vartype uri: str + All required parameters must be populated in order to send to server. + + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. "SAS" + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType """ _validation = { - "job_input_type": {"required": True}, - "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "credential_type": {"required": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_input_type": {"key": "jobInputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "credential_type": {"key": "credentialType", "type": "str"}, + } + + _subtype_map = {"credential_type": {"SAS": "SASCredentialDto"}} + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.credential_type: Optional[str] = None + + +class PendingUploadRequestDto(_serialization.Model): + """PendingUploadRequestDto. + + :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Known values are: + "None" and "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType + """ + + _attribute_map = { + "pending_upload_id": {"key": "pendingUploadId", "type": "str"}, + "pending_upload_type": {"key": "pendingUploadType", "type": "str"}, } def __init__( self, *, - uri: str, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.InputDeliveryMode"]] = None, + pending_upload_id: Optional[str] = None, + pending_upload_type: Optional[Union[str, "_models.PendingUploadType"]] = None, **kwargs: Any ) -> None: """ - :keyword description: Description for the input. - :paramtype description: str - :keyword mode: Input Asset Delivery Mode. Known values are: "ReadOnlyMount", "ReadWriteMount", - "Download", "Direct", "EvalMount", and "EvalDownload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.InputDeliveryMode - :keyword uri: [Required] Input Asset URI. Required. - :paramtype uri: str + :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Known values + are: "None" and "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) - self.description = description - self.job_input_type: str = "mltable" - self.mode = mode - self.uri = uri - + super().__init__(**kwargs) + self.pending_upload_id = pending_upload_id + self.pending_upload_type = pending_upload_type -class MLTableJobOutput(AssetJobOutput, JobOutput): - """MLTableJobOutput. - All required parameters must be populated in order to send to Azure. +class PendingUploadResponseDto(_serialization.Model): + """PendingUploadResponseDto. - :ivar description: Description for the output. - :vartype description: str - :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". - :vartype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :ivar uri: Output Asset URI. - :vartype uri: str + :ivar blob_reference_for_consumption: Container level read, write, list SAS. + :vartype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :ivar pending_upload_id: ID for this upload request. + :vartype pending_upload_id: str + :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Known values are: + "None" and "TemporaryBlobReference". + :vartype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - _validation = { - "job_output_type": {"required": True}, - } - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "job_output_type": {"key": "jobOutputType", "type": "str"}, - "mode": {"key": "mode", "type": "str"}, - "uri": {"key": "uri", "type": "str"}, + "blob_reference_for_consumption": { + "key": "blobReferenceForConsumption", + "type": "BlobReferenceForConsumptionDto", + }, + "pending_upload_id": {"key": "pendingUploadId", "type": "str"}, + "pending_upload_type": {"key": "pendingUploadType", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, - uri: Optional[str] = None, + blob_reference_for_consumption: Optional["_models.BlobReferenceForConsumptionDto"] = None, + pending_upload_id: Optional[str] = None, + pending_upload_type: Optional[Union[str, "_models.PendingUploadType"]] = None, **kwargs: Any ) -> None: """ - :keyword description: Description for the output. - :paramtype description: str - :keyword mode: Output Asset Delivery Mode. Known values are: "ReadWriteMount" and "Upload". - :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.OutputDeliveryMode - :keyword uri: Output Asset URI. - :paramtype uri: str + :keyword blob_reference_for_consumption: Container level read, write, list SAS. + :paramtype blob_reference_for_consumption: + ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto + :keyword pending_upload_id: ID for this upload request. + :paramtype pending_upload_id: str + :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Known values + are: "None" and "TemporaryBlobReference". + :paramtype pending_upload_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadType """ - super().__init__(mode=mode, uri=uri, description=description, **kwargs) - self.description = description - self.job_output_type: str = "mltable" - self.mode = mode - self.uri = uri - - -class ModelContainer(Resource): - """Azure Resource Manager resource envelope. + super().__init__(**kwargs) + self.blob_reference_for_consumption = blob_reference_for_consumption + self.pending_upload_id = pending_upload_id + self.pending_upload_type = pending_upload_type - 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. +class PersonalComputeInstanceSettings(_serialization.Model): + """Settings for a personal compute instance. - :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.ModelContainerProperties + :ivar assigned_user: A user explicitly assigned to a personal compute instance. + :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": 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"}, - "properties": {"key": "properties", "type": "ModelContainerProperties"}, + "assigned_user": {"key": "assignedUser", "type": "AssignedUser"}, } - def __init__(self, *, properties: "_models.ModelContainerProperties", **kwargs: Any) -> None: + def __init__(self, *, assigned_user: Optional["_models.AssignedUser"] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelContainerProperties + :keyword assigned_user: A user explicitly assigned to a personal compute instance. + :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser """ super().__init__(**kwargs) - self.properties = properties + self.assigned_user = assigned_user -class ModelContainerProperties(AssetContainer): - """ModelContainerProperties. +class PipelineJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Pipeline Job definition: defines generic to MFE attributes. 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 server. + :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 latest_version: The latest version inside this container. - :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 + :ivar job_type: [Required] Specifies the type of job. Required. Known values are: "AutoML", + "Command", "Sweep", "Pipeline", "Spark", and "FineTuning". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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". + :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] + :ivar jobs: Jobs construct the Pipeline Job. + :vartype jobs: dict[str, JSON] + :ivar outputs: Outputs for the pipeline job. + :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :vartype settings: JSON + :ivar source_job_id: ARM resource ID of source job. + :vartype source_job_id: str """ _validation = { - "latest_version": {"readonly": True}, - "next_version": {"readonly": True}, - "provisioning_state": {"readonly": True}, + "job_type": {"required": True}, + "status": {"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"}, - "latest_version": {"key": "latestVersion", "type": "str"}, - "next_version": {"key": "nextVersion", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, + "job_type": {"key": "jobType", "type": "str"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, + "services": {"key": "services", "type": "{JobService}"}, + "status": {"key": "status", "type": "str"}, + "inputs": {"key": "inputs", "type": "{JobInput}"}, + "jobs": {"key": "jobs", "type": "{object}"}, + "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "settings": {"key": "settings", "type": "object"}, + "source_job_id": {"key": "sourceJobId", "type": "str"}, } def __init__( @@ -15120,7 +26052,19 @@ def __init__( 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + services: Optional[Dict[str, "_models.JobService"]] = None, + inputs: Optional[Dict[str, "_models.JobInput"]] = None, + jobs: Optional[Dict[str, JSON]] = None, + outputs: Optional[Dict[str, "_models.JobOutput"]] = None, + settings: Optional[JSON] = None, + source_job_id: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -15130,52 +26074,171 @@ def __init__( :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 notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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 inputs: Inputs for the pipeline job. + :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] + :keyword jobs: Jobs construct the Pipeline Job. + :paramtype jobs: dict[str, JSON] + :keyword outputs: Outputs for the pipeline job. + :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. + :paramtype settings: JSON + :keyword source_job_id: ARM resource ID of source job. + :paramtype source_job_id: str + """ + 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, + notification_setting=notification_setting, + services=services, + **kwargs + ) + self.job_type: str = "Pipeline" + self.inputs = inputs + self.jobs = jobs + self.outputs = outputs + self.settings = settings + self.source_job_id = source_job_id + + +class PredictionDriftMonitoringSignal(MonitoringSignalBase): + """PredictionDriftMonitoringSignal. + + All required parameters must be populated in order to send to server. + + :ivar notification_types: The current notification mode for this signal. + :vartype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :ivar properties: Property dictionary. Properties can be added, but not removed or altered. + :vartype properties: dict[str, str] + :ivar signal_type: [Required] Specifies the type of signal to monitor. Required. Known values + are: "DataDrift", "PredictionDrift", "DataQuality", "FeatureAttributionDrift", and "Custom". + :vartype signal_type: str or ~azure.mgmt.machinelearningservices.models.MonitoringSignalType + :ivar feature_data_type_override: A dictionary that maps feature names to their respective data + types. + :vartype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :ivar metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :vartype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :ivar production_data: [Required] The data which drift will be calculated for. Required. + :vartype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :ivar reference_data: [Required] The data to calculate drift against. Required. + :vartype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + + _validation = { + "signal_type": {"required": True}, + "metric_thresholds": {"required": True}, + "production_data": {"required": True}, + "reference_data": {"required": True}, + } + + _attribute_map = { + "notification_types": {"key": "notificationTypes", "type": "[str]"}, + "properties": {"key": "properties", "type": "{str}"}, + "signal_type": {"key": "signalType", "type": "str"}, + "feature_data_type_override": {"key": "featureDataTypeOverride", "type": "{str}"}, + "metric_thresholds": {"key": "metricThresholds", "type": "[PredictionDriftMetricThresholdBase]"}, + "production_data": {"key": "productionData", "type": "MonitoringInputDataBase"}, + "reference_data": {"key": "referenceData", "type": "MonitoringInputDataBase"}, + } + + def __init__( + self, + *, + metric_thresholds: List["_models.PredictionDriftMetricThresholdBase"], + production_data: "_models.MonitoringInputDataBase", + reference_data: "_models.MonitoringInputDataBase", + notification_types: Optional[List[Union[str, "_models.MonitoringNotificationType"]]] = None, + properties: Optional[Dict[str, str]] = None, + feature_data_type_override: Optional[Dict[str, Union[str, "_models.MonitoringFeatureDataType"]]] = None, + **kwargs: Any + ) -> None: """ - super().__init__(description=description, properties=properties, tags=tags, is_archived=is_archived, **kwargs) - self.provisioning_state = None + :keyword notification_types: The current notification mode for this signal. + :paramtype notification_types: list[str or + ~azure.mgmt.machinelearningservices.models.MonitoringNotificationType] + :keyword properties: Property dictionary. Properties can be added, but not removed or altered. + :paramtype properties: dict[str, str] + :keyword feature_data_type_override: A dictionary that maps feature names to their respective + data types. + :paramtype feature_data_type_override: dict[str, str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureDataType] + :keyword metric_thresholds: [Required] A list of metrics to calculate and their associated + thresholds. Required. + :paramtype metric_thresholds: + list[~azure.mgmt.machinelearningservices.models.PredictionDriftMetricThresholdBase] + :keyword production_data: [Required] The data which drift will be calculated for. Required. + :paramtype production_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + :keyword reference_data: [Required] The data to calculate drift against. Required. + :paramtype reference_data: ~azure.mgmt.machinelearningservices.models.MonitoringInputDataBase + """ + super().__init__(notification_types=notification_types, properties=properties, **kwargs) + self.signal_type: str = "PredictionDrift" + self.feature_data_type_override = feature_data_type_override + self.metric_thresholds = metric_thresholds + self.production_data = production_data + self.reference_data = reference_data -class ModelContainerResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ModelContainer entities. +class PrivateEndpoint(_serialization.Model): + """The Private Endpoint resource. - :ivar next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelContainer. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str """ + _validation = { + "id": {"readonly": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ModelContainer]"}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelContainer"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link to the next page of ModelContainer objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelContainer. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelContainer] - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.id = None -class ModelVersion(Resource): - """Azure Resource Manager resource envelope. +class PrivateEndpointConnection(Resource): # pylint: disable=too-many-instance-attributes + """The Private Endpoint Connection resource. 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}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15185,8 +26248,25 @@ class ModelVersion(Resource): :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.ModelVersionProperties + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar private_endpoint: The Private Endpoint resource. + :vartype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :ivar private_link_service_connection_state: The connection state. + :vartype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The current provisioning state. Known values are: "Succeeded", + "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ _validation = { @@ -15194,7 +26274,6 @@ class ModelVersion(Resource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "properties": {"required": True}, } _attribute_map = { @@ -15202,696 +26281,663 @@ class ModelVersion(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ModelVersionProperties"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "WorkspacePrivateEndpointResource"}, + "private_link_service_connection_state": { + "key": "properties.privateLinkServiceConnectionState", + "type": "PrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - def __init__(self, *, properties: "_models.ModelVersionProperties", **kwargs: Any) -> None: + def __init__( + self, + *, + identity: Optional["_models.ManagedServiceIdentity"] = None, + location: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + tags: Optional[Dict[str, str]] = None, + private_endpoint: Optional["_models.WorkspacePrivateEndpointResource"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs: Any + ) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ModelVersionProperties + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword private_endpoint: The Private Endpoint resource. + :paramtype private_endpoint: + ~azure.mgmt.machinelearningservices.models.WorkspacePrivateEndpointResource + :keyword private_link_service_connection_state: The connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: The current provisioning state. Known values are: "Succeeded", + "Creating", "Deleting", and "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState """ super().__init__(**kwargs) - self.properties = properties - + self.identity = identity + self.location = location + self.sku = sku + self.tags = tags + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state -class ModelVersionProperties(AssetBase): # pylint: disable=too-many-instance-attributes - """Model asset version details. - Variables are only populated by the server, and will be ignored when sending a request. +class PrivateEndpointConnectionListResult(_serialization.Model): + """List of private endpoint connection associated with the specified workspace. - :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 is_anonymous: If the name version are system generated (anonymous registration). - :vartype is_anonymous: bool - :ivar is_archived: Is the asset archived?. - :vartype is_archived: bool - :ivar flavors: Mapping of model flavors to their properties. - :vartype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :ivar job_name: Name of the training job which produced this model. - :vartype job_name: str - :ivar model_type: The storage format for this entity. Used for NCD. - :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 - :ivar stage: Stage in the model lifecycle assigned to this model. - :vartype stage: str + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] """ - _validation = { - "provisioning_state": {"readonly": True}, + _attribute_map = { + "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + """ + super().__init__(**kwargs) + self.value = value + + +class PrivateEndpointDestination(_serialization.Model): + """Private Endpoint destination for a Private Endpoint Outbound Rule for the managed network of a + machine learning workspace. + + :ivar service_resource_id: + :vartype service_resource_id: str + :ivar spark_enabled: + :vartype spark_enabled: bool + :ivar spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Inactive" and "Active". + :vartype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar subresource_target: + :vartype subresource_target: str + """ + _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "is_anonymous": {"key": "isAnonymous", "type": "bool"}, - "is_archived": {"key": "isArchived", "type": "bool"}, - "flavors": {"key": "flavors", "type": "{FlavorData}"}, - "job_name": {"key": "jobName", "type": "str"}, - "model_type": {"key": "modelType", "type": "str"}, - "model_uri": {"key": "modelUri", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "stage": {"key": "stage", "type": "str"}, + "service_resource_id": {"key": "serviceResourceId", "type": "str"}, + "spark_enabled": {"key": "sparkEnabled", "type": "bool"}, + "spark_status": {"key": "sparkStatus", "type": "str"}, + "subresource_target": {"key": "subresourceTarget", "type": "str"}, } def __init__( self, *, - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - is_anonymous: bool = False, - is_archived: bool = False, - flavors: Optional[Dict[str, "_models.FlavorData"]] = None, - job_name: Optional[str] = None, - model_type: Optional[str] = None, - model_uri: Optional[str] = None, - stage: Optional[str] = None, + service_resource_id: Optional[str] = None, + spark_enabled: Optional[bool] = None, + spark_status: Optional[Union[str, "_models.RuleStatus"]] = None, + subresource_target: Optional[str] = None, **kwargs: Any ) -> None: """ - :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 is_anonymous: If the name version are system generated (anonymous registration). - :paramtype is_anonymous: bool - :keyword is_archived: Is the asset archived?. - :paramtype is_archived: bool - :keyword flavors: Mapping of model flavors to their properties. - :paramtype flavors: dict[str, ~azure.mgmt.machinelearningservices.models.FlavorData] - :keyword job_name: Name of the training job which produced this model. - :paramtype job_name: str - :keyword model_type: The storage format for this entity. Used for NCD. - :paramtype model_type: str - :keyword model_uri: The URI path to the model contents. - :paramtype model_uri: str - :keyword stage: Stage in the model lifecycle assigned to this model. - :paramtype stage: str + :keyword service_resource_id: + :paramtype service_resource_id: str + :keyword spark_enabled: + :paramtype spark_enabled: bool + :keyword spark_status: Type of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Inactive" and "Active". + :paramtype spark_status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword subresource_target: + :paramtype subresource_target: str """ - super().__init__( - description=description, - properties=properties, - tags=tags, - is_anonymous=is_anonymous, - is_archived=is_archived, - **kwargs - ) - self.flavors = flavors - self.job_name = job_name - self.model_type = model_type - self.model_uri = model_uri - self.provisioning_state = None - self.stage = stage + super().__init__(**kwargs) + self.service_resource_id = service_resource_id + self.spark_enabled = spark_enabled + self.spark_status = spark_status + self.subresource_target = subresource_target -class ModelVersionResourceArmPaginatedResult(_serialization.Model): - """A paginated list of ModelVersion entities. +class PrivateEndpointOutboundRule(OutboundRule): + """Private Endpoint Outbound Rule for the managed network of a machine learning workspace. - :ivar next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type ModelVersion. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + 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 server. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Type of a managed network Outbound Rule of a machine learning workspace. Required. + Known values are: "FQDN", "PrivateEndpoint", and "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :vartype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :ivar fqdns: + :vartype fqdns: list[str] """ + _validation = { + "parent_rule_names": {"readonly": True}, + "type": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ModelVersion]"}, + "category": {"key": "category", "type": "str"}, + "parent_rule_names": {"key": "parentRuleNames", "type": "[str]"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "destination": {"key": "destination", "type": "PrivateEndpointDestination"}, + "fqdns": {"key": "fqdns", "type": "[str]"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.ModelVersion"]] = None, **kwargs: Any + self, + *, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + destination: Optional["_models.PrivateEndpointDestination"] = None, + fqdns: Optional[List[str]] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of ModelVersion objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type ModelVersion. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ModelVersion] + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: Private Endpoint destination for a Private Endpoint Outbound Rule for the + managed network of a machine learning workspace. + :paramtype destination: ~azure.mgmt.machinelearningservices.models.PrivateEndpointDestination + :keyword fqdns: + :paramtype fqdns: list[str] """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value + super().__init__(category=category, status=status, **kwargs) + self.type: str = "PrivateEndpoint" + self.destination = destination + self.fqdns = fqdns -class Mpi(DistributionConfiguration): - """MPI distribution configuration. +class PrivateEndpointResource(PrivateEndpoint): + """The PE network resource that is linked to this PE connection. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. - Known values are: "PyTorch", "TensorFlow", and "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per MPI node. - :vartype process_count_per_instance: int + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str """ _validation = { - "distribution_type": {"required": True}, + "id": {"readonly": True}, } _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, - "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, + "id": {"key": "id", "type": "str"}, + "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, } - def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs: Any) -> None: + def __init__(self, *, subnet_arm_id: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword process_count_per_instance: Number of processes per MPI node. - :paramtype process_count_per_instance: int + :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. + :paramtype subnet_arm_id: str """ super().__init__(**kwargs) - self.distribution_type: str = "Mpi" - self.process_count_per_instance = process_count_per_instance + self.subnet_arm_id = subnet_arm_id -class NlpVertical(_serialization.Model): - """Abstract class for NLP related AutoML tasks. - NLP - Natural Language Processing. +class PrivateLinkResource(Resource): # pylint: disable=too-many-instance-attributes + """A private link resource. - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :ivar limit_settings: Execution constraints for AutoMLJob. - :vartype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar location: Same as workspace location. + :vartype location: str + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar tags: Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + _attribute_map = { - "featurization_settings": {"key": "featurizationSettings", "type": "NlpVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "NlpVerticalLimitSettings"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, + "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } def __init__( self, *, - featurization_settings: Optional["_models.NlpVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.NlpVerticalLimitSettings"] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + location: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + tags: Optional[Dict[str, str]] = None, + group_id: Optional[str] = None, + required_members: Optional[List[str]] = None, + required_zone_names: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.NlpVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: ~azure.mgmt.machinelearningservices.models.NlpVerticalLimitSettings - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword location: Same as workspace location. + :paramtype location: str + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword tags: Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword group_id: The private link resource group id. + :paramtype group_id: str + :keyword required_members: The private link resource required member names. + :paramtype required_members: list[str] + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.validation_data = validation_data + self.identity = identity + self.location = location + self.sku = sku + self.tags = tags + self.group_id = group_id + self.required_members = required_members + self.required_zone_names = required_zone_names -class NlpVerticalFeaturizationSettings(FeaturizationSettings): - """NlpVerticalFeaturizationSettings. +class PrivateLinkResourceListResult(_serialization.Model): + """A list of private link resources. - :ivar dataset_language: Dataset language, useful for the text data. - :vartype dataset_language: str + :ivar value: + :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ _attribute_map = { - "dataset_language": {"key": "datasetLanguage", "type": "str"}, + "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, dataset_language: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ - :keyword dataset_language: Dataset language, useful for the text data. - :paramtype dataset_language: str + :keyword value: + :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] """ - super().__init__(dataset_language=dataset_language, **kwargs) + super().__init__(**kwargs) + self.value = value -class NlpVerticalLimitSettings(_serialization.Model): - """Job execution constraints. +class PrivateLinkServiceConnectionState(_serialization.Model): + """A collection of information about the state of the connection between service consumer and + provider. - :ivar max_concurrent_trials: Maximum Concurrent AutoML iterations. - :vartype max_concurrent_trials: int - :ivar max_trials: Number of AutoML iterations. - :vartype max_trials: int - :ivar timeout: AutoML job timeout. - :vartype timeout: ~datetime.timedelta + :ivar actions_required: Some RP chose "None". Other RPs use this for region expansion. + :vartype actions_required: str + :ivar description: User-defined message that, per NRP doc, may be used for approval-related + message. + :vartype description: str + :ivar status: Connection status of the service consumer with the service provider. Known values + are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :vartype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { - "max_concurrent_trials": {"key": "maxConcurrentTrials", "type": "int"}, - "max_trials": {"key": "maxTrials", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "status": {"key": "status", "type": "str"}, } def __init__( - self, *, max_concurrent_trials: int = 1, max_trials: int = 1, timeout: datetime.timedelta = "P7D", **kwargs: Any + self, + *, + actions_required: Optional[str] = None, + description: Optional[str] = None, + status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = None, + **kwargs: Any ) -> None: """ - :keyword max_concurrent_trials: Maximum Concurrent AutoML iterations. - :paramtype max_concurrent_trials: int - :keyword max_trials: Number of AutoML iterations. - :paramtype max_trials: int - :keyword timeout: AutoML job timeout. - :paramtype timeout: ~datetime.timedelta + :keyword actions_required: Some RP chose "None". Other RPs use this for region expansion. + :paramtype actions_required: str + :keyword description: User-defined message that, per NRP doc, may be used for approval-related + message. + :paramtype description: str + :keyword status: Connection status of the service consumer with the service provider. Known + values are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :paramtype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ super().__init__(**kwargs) - self.max_concurrent_trials = max_concurrent_trials - self.max_trials = max_trials - self.timeout = timeout - - -class NodeStateCounts(_serialization.Model): - """Counts of various compute node states on the amlCompute. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar idle_node_count: Number of compute nodes in idle state. - :vartype idle_node_count: int - :ivar running_node_count: Number of compute nodes which are running jobs. - :vartype running_node_count: int - :ivar preparing_node_count: Number of compute nodes which are being prepared. - :vartype preparing_node_count: int - :ivar unusable_node_count: Number of compute nodes which are in unusable state. - :vartype unusable_node_count: int - :ivar leaving_node_count: Number of compute nodes which are leaving the amlCompute. - :vartype leaving_node_count: int - :ivar preempted_node_count: Number of compute nodes which are in preempted state. - :vartype preempted_node_count: int - """ - - _validation = { - "idle_node_count": {"readonly": True}, - "running_node_count": {"readonly": True}, - "preparing_node_count": {"readonly": True}, - "unusable_node_count": {"readonly": True}, - "leaving_node_count": {"readonly": True}, - "preempted_node_count": {"readonly": True}, - } - - _attribute_map = { - "idle_node_count": {"key": "idleNodeCount", "type": "int"}, - "running_node_count": {"key": "runningNodeCount", "type": "int"}, - "preparing_node_count": {"key": "preparingNodeCount", "type": "int"}, - "unusable_node_count": {"key": "unusableNodeCount", "type": "int"}, - "leaving_node_count": {"key": "leavingNodeCount", "type": "int"}, - "preempted_node_count": {"key": "preemptedNodeCount", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.idle_node_count = None - self.running_node_count = None - self.preparing_node_count = None - self.unusable_node_count = None - self.leaving_node_count = None - self.preempted_node_count = None - + self.actions_required = actions_required + self.description = description + self.status = status -class NoneAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """NoneAuthTypeWorkspaceConnectionProperties. - All required parameters must be populated in order to send to Azure. +class ProbeSettings(_serialization.Model): + """Deployment container liveness/readiness probe configuration. - :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 + :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. + :vartype failure_threshold: int + :ivar initial_delay: The delay before the first probe in ISO 8601 format. + :vartype initial_delay: ~datetime.timedelta + :ivar period: The length of time between probes in ISO 8601 format. + :vartype period: ~datetime.timedelta + :ivar success_threshold: The number of successful probes before returning a healthy status. + :vartype success_threshold: int + :ivar timeout: The probe timeout in ISO 8601 format. + :vartype timeout: ~datetime.timedelta """ - _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"}, + "failure_threshold": {"key": "failureThreshold", "type": "int"}, + "initial_delay": {"key": "initialDelay", "type": "duration"}, + "period": {"key": "period", "type": "duration"}, + "success_threshold": {"key": "successThreshold", "type": "int"}, + "timeout": {"key": "timeout", "type": "duration"}, } 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, + failure_threshold: int = 30, + initial_delay: Optional[datetime.timedelta] = None, + period: datetime.timedelta = "PT10S", + success_threshold: int = 1, + timeout: datetime.timedelta = "PT2S", **kwargs: Any ) -> None: """ - :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 + :keyword failure_threshold: The number of failures to allow before returning an unhealthy + status. + :paramtype failure_threshold: int + :keyword initial_delay: The delay before the first probe in ISO 8601 format. + :paramtype initial_delay: ~datetime.timedelta + :keyword period: The length of time between probes in ISO 8601 format. + :paramtype period: ~datetime.timedelta + :keyword success_threshold: The number of successful probes before returning a healthy status. + :paramtype success_threshold: int + :keyword timeout: The probe timeout in ISO 8601 format. + :paramtype timeout: ~datetime.timedelta """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "None" + super().__init__(**kwargs) + self.failure_threshold = failure_threshold + self.initial_delay = initial_delay + self.period = period + self.success_threshold = success_threshold + self.timeout = timeout -class NoneDatastoreCredentials(DatastoreCredentials): - """Empty/none datastore credentials. +class PyTorch(DistributionConfiguration): + """PyTorch distribution configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". - :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. + Known values are: "PyTorch", "TensorFlow", and "Mpi". + :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType + :ivar process_count_per_instance: Number of processes per node. + :vartype process_count_per_instance: int """ _validation = { - "credentials_type": {"required": True}, + "distribution_type": {"required": True}, } _attribute_map = { - "credentials_type": {"key": "credentialsType", "type": "str"}, + "distribution_type": {"key": "distributionType", "type": "str"}, + "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword process_count_per_instance: Number of processes per node. + :paramtype process_count_per_instance: int + """ super().__init__(**kwargs) - self.credentials_type: str = "None" - + self.distribution_type: str = "PyTorch" + self.process_count_per_instance = process_count_per_instance -class NotebookAccessTokenResult(_serialization.Model): - """NotebookAccessTokenResult. - Variables are only populated by the server, and will be ignored when sending a request. +class QueueSettings(_serialization.Model): + """QueueSettings. - :ivar notebook_resource_id: - :vartype notebook_resource_id: str - :ivar host_name: - :vartype host_name: str - :ivar public_dns: - :vartype public_dns: str - :ivar access_token: - :vartype access_token: str - :ivar token_type: - :vartype token_type: str - :ivar expires_in: - :vartype expires_in: int - :ivar refresh_token: - :vartype refresh_token: str - :ivar scope: - :vartype scope: str + :ivar job_tier: Controls the compute job tier. Known values are: "Null", "Spot", "Basic", + "Standard", and "Premium". + :vartype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier """ - _validation = { - "notebook_resource_id": {"readonly": True}, - "host_name": {"readonly": True}, - "public_dns": {"readonly": True}, - "access_token": {"readonly": True}, - "token_type": {"readonly": True}, - "expires_in": {"readonly": True}, - "refresh_token": {"readonly": True}, - "scope": {"readonly": True}, - } - _attribute_map = { - "notebook_resource_id": {"key": "notebookResourceId", "type": "str"}, - "host_name": {"key": "hostName", "type": "str"}, - "public_dns": {"key": "publicDns", "type": "str"}, - "access_token": {"key": "accessToken", "type": "str"}, - "token_type": {"key": "tokenType", "type": "str"}, - "expires_in": {"key": "expiresIn", "type": "int"}, - "refresh_token": {"key": "refreshToken", "type": "str"}, - "scope": {"key": "scope", "type": "str"}, + "job_tier": {"key": "jobTier", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, job_tier: Optional[Union[str, "_models.JobTier"]] = None, **kwargs: Any) -> None: + """ + :keyword job_tier: Controls the compute job tier. Known values are: "Null", "Spot", "Basic", + "Standard", and "Premium". + :paramtype job_tier: str or ~azure.mgmt.machinelearningservices.models.JobTier + """ super().__init__(**kwargs) - self.notebook_resource_id = None - self.host_name = None - self.public_dns = None - self.access_token = None - self.token_type = None - self.expires_in = None - self.refresh_token = None - self.scope = None + self.job_tier = job_tier -class NotebookPreparationError(_serialization.Model): - """NotebookPreparationError. +class QuotaBaseProperties(_serialization.Model): + """The properties for Quota update or retrieval. - :ivar error_message: - :vartype error_message: str - :ivar status_code: - :vartype status_code: int + :ivar id: Specifies the resource ID. + :vartype id: str + :ivar type: Specifies the resource type. + :vartype type: str + :ivar limit: The maximum permitted quota of the resource. + :vartype limit: int + :ivar unit: An enum describing the unit of quota measurement. "Count" + :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ _attribute_map = { - "error_message": {"key": "errorMessage", "type": "str"}, - "status_code": {"key": "statusCode", "type": "int"}, + "id": {"key": "id", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "limit": {"key": "limit", "type": "int"}, + "unit": {"key": "unit", "type": "str"}, } def __init__( - self, *, error_message: Optional[str] = None, status_code: Optional[int] = None, **kwargs: Any + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + type: Optional[str] = None, + limit: Optional[int] = None, + unit: Optional[Union[str, "_models.QuotaUnit"]] = None, + **kwargs: Any ) -> None: """ - :keyword error_message: - :paramtype error_message: str - :keyword status_code: - :paramtype status_code: int + :keyword id: Specifies the resource ID. + :paramtype id: str + :keyword type: Specifies the resource type. + :paramtype type: str + :keyword limit: The maximum permitted quota of the resource. + :paramtype limit: int + :keyword unit: An enum describing the unit of quota measurement. "Count" + :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ super().__init__(**kwargs) - self.error_message = error_message - self.status_code = status_code + self.id = id + self.type = type + self.limit = limit + self.unit = unit -class NotebookResourceInfo(_serialization.Model): - """NotebookResourceInfo. +class QuotaUpdateParameters(_serialization.Model): + """Quota update parameters. - :ivar fqdn: - :vartype fqdn: str - :ivar resource_id: the data plane resourceId that used to initialize notebook component. - :vartype resource_id: str - :ivar notebook_preparation_error: The error that occurs when preparing notebook. - :vartype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :ivar value: The list for update quota. + :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :ivar location: Region of workspace quota to be updated. + :vartype location: str """ _attribute_map = { - "fqdn": {"key": "fqdn", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "notebook_preparation_error": {"key": "notebookPreparationError", "type": "NotebookPreparationError"}, + "value": {"key": "value", "type": "[QuotaBaseProperties]"}, + "location": {"key": "location", "type": "str"}, } def __init__( self, *, - fqdn: Optional[str] = None, - resource_id: Optional[str] = None, - notebook_preparation_error: Optional["_models.NotebookPreparationError"] = None, + value: Optional[List["_models.QuotaBaseProperties"]] = None, + location: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword fqdn: - :paramtype fqdn: str - :keyword resource_id: the data plane resourceId that used to initialize notebook component. - :paramtype resource_id: str - :keyword notebook_preparation_error: The error that occurs when preparing notebook. - :paramtype notebook_preparation_error: - ~azure.mgmt.machinelearningservices.models.NotebookPreparationError + :keyword value: The list for update quota. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] + :keyword location: Region of workspace quota to be updated. + :paramtype location: str """ super().__init__(**kwargs) - self.fqdn = fqdn - self.resource_id = resource_id - self.notebook_preparation_error = notebook_preparation_error - + self.value = value + self.location = location -class Objective(_serialization.Model): - """Optimization objective. - All required parameters must be populated in order to send to Azure. +class RaiBlocklistConfig(_serialization.Model): + """Azure OpenAI blocklist config. - :ivar goal: [Required] Defines supported metric goals for hyperparameter tuning. Required. - Known values are: "Minimize" and "Maximize". - :vartype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :ivar primary_metric: [Required] Name of the metric to optimize. Required. - :vartype primary_metric: str + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar blocklist_name: Name of ContentFilter. + :vartype blocklist_name: str """ - _validation = { - "goal": {"required": True}, - "primary_metric": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - } - _attribute_map = { - "goal": {"key": "goal", "type": "str"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, + "blocking": {"key": "blocking", "type": "bool"}, + "blocklist_name": {"key": "blocklistName", "type": "str"}, } - def __init__(self, *, goal: Union[str, "_models.Goal"], primary_metric: str, **kwargs: Any) -> None: + def __init__(self, *, blocking: Optional[bool] = None, blocklist_name: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword goal: [Required] Defines supported metric goals for hyperparameter tuning. Required. - Known values are: "Minimize" and "Maximize". - :paramtype goal: str or ~azure.mgmt.machinelearningservices.models.Goal - :keyword primary_metric: [Required] Name of the metric to optimize. Required. - :paramtype primary_metric: str + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword blocklist_name: Name of ContentFilter. + :paramtype blocklist_name: str """ super().__init__(**kwargs) - self.goal = goal - self.primary_metric = primary_metric - - -class OnlineDeployment(TrackedResource): - """OnlineDeployment. - - 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. + self.blocking = blocking + self.blocklist_name = blocklist_name - :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.OnlineDeploymentProperties - :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}, - } +class RaiBlocklistItemBulkRequest(_serialization.Model): + """The Cognitive Services RaiBlocklist Item request body. + + :ivar name: + :vartype name: str + :ivar properties: Properties of Cognitive Services RaiBlocklist Item. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties + """ _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": "OnlineDeploymentProperties"}, - "sku": {"key": "sku", "type": "Sku"}, + "properties": {"key": "properties", "type": "RaiBlocklistItemProperties"}, } def __init__( self, *, - location: str, - properties: "_models.OnlineDeploymentProperties", - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[str] = None, - sku: Optional["_models.Sku"] = None, + name: Optional[str] = None, + properties: Optional["_models.RaiBlocklistItemProperties"] = None, **kwargs: Any ) -> None: """ - :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.OnlineDeploymentProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword name: + :paramtype name: str + :keyword properties: Properties of Cognitive Services RaiBlocklist Item. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind + super().__init__(**kwargs) + self.name = name self.properties = properties - self.sku = sku -class OnlineDeploymentTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of OnlineDeployment entities. +class RaiBlocklistItemProperties(_serialization.Model): + """RAI Custom Blocklist Item properties. - :ivar next_link: The link to the next page of OnlineDeployment objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type OnlineDeployment. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :ivar is_regex: If the pattern is a regex pattern. + :vartype is_regex: bool + :ivar pattern: Pattern to match against. + :vartype pattern: str """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OnlineDeployment]"}, + "is_regex": {"key": "isRegex", "type": "bool"}, + "pattern": {"key": "pattern", "type": "str"}, } - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.OnlineDeployment"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, is_regex: Optional[bool] = None, pattern: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword next_link: The link to the next page of OnlineDeployment objects. If null, there are - no additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type OnlineDeployment. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineDeployment] + :keyword is_regex: If the pattern is a regex pattern. + :paramtype is_regex: bool + :keyword pattern: Pattern to match against. + :paramtype pattern: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.is_regex = is_regex + self.pattern = pattern -class OnlineEndpoint(TrackedResource): - """OnlineEndpoint. +class RaiBlocklistItemPropertiesBasicResource(Resource): + """RaiBlocklistItemPropertiesBasicResource. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -15901,19 +26947,8 @@ class OnlineEndpoint(TrackedResource): :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.OnlineEndpointProperties - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar properties: RAI Custom Blocklist Item properties. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ _validation = { @@ -15921,7 +26956,6 @@ class OnlineEndpoint(TrackedResource): "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, "properties": {"required": True}, } @@ -15930,1726 +26964,2027 @@ class OnlineEndpoint(TrackedResource): "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": "OnlineEndpointProperties"}, - "sku": {"key": "sku", "type": "Sku"}, + "properties": {"key": "properties", "type": "RaiBlocklistItemProperties"}, } - def __init__( - self, - *, - location: str, - properties: "_models.OnlineEndpointProperties", - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[str] = None, - sku: Optional["_models.Sku"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.RaiBlocklistItemProperties", **kwargs: Any) -> None: """ - :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.OnlineEndpointProperties - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword properties: RAI Custom Blocklist Item properties. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemProperties """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind + super().__init__(**kwargs) self.properties = properties - self.sku = sku - - -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. - All required parameters must be populated in order to send to Azure. +class RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult. - :ivar auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure - Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. - Required. Known values are: "AMLToken", "Key", and "AADToken". - :vartype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :ivar description: Description of the inference endpoint. - :vartype description: str - :ivar keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :vartype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :ivar properties: Property dictionary. Properties can be added, but not removed or altered. - :vartype properties: dict[str, str] - :ivar scoring_uri: Endpoint URI. - :vartype scoring_uri: str - :ivar swagger_uri: Endpoint Swagger URI. - :vartype swagger_uri: str - :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 - ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState - :ivar public_network_access: Set to "Enabled" for endpoints that should allow public access - when Private Link is enabled. Known values are: "Enabled" and "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :ivar traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic values - need to sum to 100. - :vartype traffic: dict[str, int] + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ - _validation = { - "auth_mode": {"required": True}, - "scoring_uri": {"readonly": True}, - "swagger_uri": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - _attribute_map = { - "auth_mode": {"key": "authMode", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "keys": {"key": "keys", "type": "EndpointAuthKeys"}, - "properties": {"key": "properties", "type": "{str}"}, - "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}"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiBlocklistItemPropertiesBasicResource]"}, } def __init__( self, *, - auth_mode: Union[str, "_models.EndpointAuthMode"], - description: Optional[str] = None, - 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, + next_link: Optional[str] = None, + value: Optional[List["_models.RaiBlocklistItemPropertiesBasicResource"]] = None, **kwargs: Any ) -> None: """ - :keyword auth_mode: [Required] Use 'Key' for key based authentication and 'AMLToken' for Azure - Machine Learning token-based authentication. 'Key' doesn't expire but 'AMLToken' does. - Required. Known values are: "AMLToken", "Key", and "AADToken". - :paramtype auth_mode: str or ~azure.mgmt.machinelearningservices.models.EndpointAuthMode - :keyword description: Description of the inference endpoint. - :paramtype description: str - :keyword keys: EndpointAuthKeys to set initially on an Endpoint. - This property will always be returned as null. AuthKey values must be retrieved using the - ListKeys API. - :paramtype keys: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys - :keyword properties: Property dictionary. Properties can be added, but not removed or altered. - :paramtype properties: dict[str, str] - :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 - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType - :keyword traffic: Percentage of traffic from endpoint to divert to each deployment. Traffic - values need to sum to 100. - :paramtype traffic: dict[str, int] - """ - 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 - - -class OnlineEndpointTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of OnlineEndpoint entities. - - :ivar next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type OnlineEndpoint. - :vartype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[OnlineEndpoint]"}, - } - - def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.OnlineEndpoint"]] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: The link to the next page of OnlineEndpoint objects. If null, there are no - additional pages. + :keyword next_link: :paramtype next_link: str - :keyword value: An array of objects of type OnlineEndpoint. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] """ super().__init__(**kwargs) self.next_link = next_link self.value = value -class OnlineRequestSettings(_serialization.Model): - """Online deployment scoring requests configuration. +class RaiBlocklistProperties(_serialization.Model): + """RAI Custom Blocklist properties. - :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node - allowed per deployment. Defaults to 1. - :vartype max_concurrent_requests_per_instance: int - :ivar max_queue_wait: The maximum amount of time a request will stay in the queue in ISO 8601 - format. - Defaults to 500ms. - :vartype max_queue_wait: ~datetime.timedelta - :ivar request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :vartype request_timeout: ~datetime.timedelta + :ivar description: Description of the block list. + :vartype description: str """ _attribute_map = { - "max_concurrent_requests_per_instance": {"key": "maxConcurrentRequestsPerInstance", "type": "int"}, - "max_queue_wait": {"key": "maxQueueWait", "type": "duration"}, - "request_timeout": {"key": "requestTimeout", "type": "duration"}, + "description": {"key": "description", "type": "str"}, } - def __init__( - self, - *, - max_concurrent_requests_per_instance: int = 1, - max_queue_wait: datetime.timedelta = "PT0.5S", - request_timeout: datetime.timedelta = "PT5S", - **kwargs: Any - ) -> None: + def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per - node allowed per deployment. Defaults to 1. - :paramtype max_concurrent_requests_per_instance: int - :keyword max_queue_wait: The maximum amount of time a request will stay in the queue in ISO - 8601 format. - Defaults to 500ms. - :paramtype max_queue_wait: ~datetime.timedelta - :keyword request_timeout: The scoring timeout in ISO 8601 format. - Defaults to 5000ms. - :paramtype request_timeout: ~datetime.timedelta + :keyword description: Description of the block list. + :paramtype description: str """ super().__init__(**kwargs) - self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance - self.max_queue_wait = max_queue_wait - self.request_timeout = request_timeout + self.description = description -class OutputPathAssetReference(AssetReferenceBase): - """Reference to an asset via its path in a job output. +class RaiBlocklistPropertiesBasicResource(Resource): + """RaiBlocklistPropertiesBasicResource. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar reference_type: [Required] Specifies the type of asset reference. Required. Known values - are: "Id", "DataPath", and "OutputPath". - :vartype reference_type: str or ~azure.mgmt.machinelearningservices.models.ReferenceType - :ivar job_id: ARM resource ID of the job. - :vartype job_id: str - :ivar path: The path of the file/directory in the job output. - :vartype path: str + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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: RAI Custom Blocklist properties. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ _validation = { - "reference_type": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "properties": {"required": True}, } _attribute_map = { - "reference_type": {"key": "referenceType", "type": "str"}, - "job_id": {"key": "jobId", "type": "str"}, - "path": {"key": "path", "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": "RaiBlocklistProperties"}, } - def __init__(self, *, job_id: Optional[str] = None, path: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, properties: "_models.RaiBlocklistProperties", **kwargs: Any) -> None: """ - :keyword job_id: ARM resource ID of the job. - :paramtype job_id: str - :keyword path: The path of the file/directory in the job output. - :paramtype path: str + :keyword properties: RAI Custom Blocklist properties. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiBlocklistProperties """ super().__init__(**kwargs) - self.reference_type: str = "OutputPath" - self.job_id = job_id - self.path = path + self.properties = properties -class PaginatedComputeResourcesList(_serialization.Model): - """Paginated list of Machine Learning compute objects wrapped in ARM resource envelope. +class RaiBlocklistPropertiesBasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """RaiBlocklistPropertiesBasicResourceArmPaginatedResult. - :ivar value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :vartype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :ivar next_link: A continuation link (absolute URI) to the next page of results in the list. + :ivar next_link: :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] """ _attribute_map = { - "value": {"key": "value", "type": "[ComputeResource]"}, "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiBlocklistPropertiesBasicResource]"}, } def __init__( - self, *, value: Optional[List["_models.ComputeResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.RaiBlocklistPropertiesBasicResource"]] = None, + **kwargs: Any ) -> None: """ - :keyword value: An array of Machine Learning compute objects wrapped in ARM resource envelope. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.ComputeResource] - :keyword next_link: A continuation link (absolute URI) to the next page of results in the list. + :keyword next_link: :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] """ super().__init__(**kwargs) - self.value = value self.next_link = next_link + self.value = value -class PartialBatchDeployment(_serialization.Model): - """Mutable batch inference settings per deployment. +class RaiPolicyContentFilter(_serialization.Model): + """Azure OpenAI Content Filter. - :ivar description: Description of the endpoint deployment. - :vartype description: str + :ivar allowed_content_level: Level at which content is filtered. Known values are: "Low", + "Medium", and "High". + :vartype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :ivar blocking: If blocking would occur. + :vartype blocking: bool + :ivar enabled: If the ContentFilter is enabled. + :vartype enabled: bool + :ivar name: Name of ContentFilter. + :vartype name: str + :ivar source: Content source to apply the Content Filters. Known values are: "Prompt" and + "Completion". + :vartype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource """ _attribute_map = { - "description": {"key": "description", "type": "str"}, + "allowed_content_level": {"key": "allowedContentLevel", "type": "str"}, + "blocking": {"key": "blocking", "type": "bool"}, + "enabled": {"key": "enabled", "type": "bool"}, + "name": {"key": "name", "type": "str"}, + "source": {"key": "source", "type": "str"}, } - def __init__(self, *, description: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + allowed_content_level: Optional[Union[str, "_models.AllowedContentLevel"]] = None, + blocking: Optional[bool] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + source: Optional[Union[str, "_models.RaiPolicyContentSource"]] = None, + **kwargs: Any + ) -> None: """ - :keyword description: Description of the endpoint deployment. - :paramtype description: str + :keyword allowed_content_level: Level at which content is filtered. Known values are: "Low", + "Medium", and "High". + :paramtype allowed_content_level: str or + ~azure.mgmt.machinelearningservices.models.AllowedContentLevel + :keyword blocking: If blocking would occur. + :paramtype blocking: bool + :keyword enabled: If the ContentFilter is enabled. + :paramtype enabled: bool + :keyword name: Name of ContentFilter. + :paramtype name: str + :keyword source: Content source to apply the Content Filters. Known values are: "Prompt" and + "Completion". + :paramtype source: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyContentSource """ super().__init__(**kwargs) - self.description = description + self.allowed_content_level = allowed_content_level + self.blocking = blocking + self.enabled = enabled + self.name = name + self.source = source -class PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties(_serialization.Model): - """Strictly used in update requests. +class RaiPolicyProperties(_serialization.Model): + """Azure OpenAI Content Filters properties. - :ivar properties: Additional attributes of the entity. - :vartype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + :ivar base_policy_name: Name of the base Content Filters. + :vartype base_policy_name: str + :ivar completion_blocklists: + :vartype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar content_filters: + :vartype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :ivar mode: Content Filters mode. Known values are: "Default", "Deferred", and "Blocking". + :vartype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :ivar prompt_blocklists: + :vartype prompt_blocklists: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :ivar type: Content Filters policy type. Known values are: "UserManaged" and "SystemManaged". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType """ _attribute_map = { - "properties": {"key": "properties", "type": "PartialBatchDeployment"}, - "tags": {"key": "tags", "type": "{str}"}, + "base_policy_name": {"key": "basePolicyName", "type": "str"}, + "completion_blocklists": {"key": "completionBlocklists", "type": "[RaiBlocklistConfig]"}, + "content_filters": {"key": "contentFilters", "type": "[RaiPolicyContentFilter]"}, + "mode": {"key": "mode", "type": "str"}, + "prompt_blocklists": {"key": "promptBlocklists", "type": "[RaiBlocklistConfig]"}, + "type": {"key": "type", "type": "str"}, } def __init__( self, *, - properties: Optional["_models.PartialBatchDeployment"] = None, - tags: Optional[Dict[str, str]] = None, + base_policy_name: Optional[str] = None, + completion_blocklists: Optional[List["_models.RaiBlocklistConfig"]] = None, + content_filters: Optional[List["_models.RaiPolicyContentFilter"]] = None, + mode: Optional[Union[str, "_models.RaiPolicyMode"]] = None, + prompt_blocklists: Optional[List["_models.RaiBlocklistConfig"]] = None, + type: Optional[Union[str, "_models.RaiPolicyType"]] = None, **kwargs: Any ) -> None: """ - :keyword properties: Additional attributes of the entity. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.PartialBatchDeployment - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] + :keyword base_policy_name: Name of the base Content Filters. + :paramtype base_policy_name: str + :keyword completion_blocklists: + :paramtype completion_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword content_filters: + :paramtype content_filters: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyContentFilter] + :keyword mode: Content Filters mode. Known values are: "Default", "Deferred", and "Blocking". + :paramtype mode: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyMode + :keyword prompt_blocklists: + :paramtype prompt_blocklists: + list[~azure.mgmt.machinelearningservices.models.RaiBlocklistConfig] + :keyword type: Content Filters policy type. Known values are: "UserManaged" and + "SystemManaged". + :paramtype type: str or ~azure.mgmt.machinelearningservices.models.RaiPolicyType + """ + super().__init__(**kwargs) + self.base_policy_name = base_policy_name + self.completion_blocklists = completion_blocklists + self.content_filters = content_filters + self.mode = mode + self.prompt_blocklists = prompt_blocklists + self.type = type + + +class RaiPolicyPropertiesBasicResource(Resource): + """Azure OpenAI Content Filters resource. + + 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 server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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: Azure OpenAI Content Filters properties. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": 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"}, + "properties": {"key": "properties", "type": "RaiPolicyProperties"}, + } + + def __init__(self, *, properties: "_models.RaiPolicyProperties", **kwargs: Any) -> None: + """ + :keyword properties: Azure OpenAI Content Filters properties. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.RaiPolicyProperties """ super().__init__(**kwargs) self.properties = properties - self.tags = tags -class PartialManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). +class RaiPolicyPropertiesBasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """Azure OpenAI Content Filters resource list. - :ivar type: Managed service identity (system assigned and/or user assigned identities). Known - values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, JSON] + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ _attribute_map = { - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{object}"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[RaiPolicyPropertiesBasicResource]"}, } def __init__( self, *, - type: Optional[Union[str, "_models.ManagedServiceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, JSON]] = None, + next_link: Optional[str] = None, + value: Optional[List["_models.RaiPolicyPropertiesBasicResource"]] = None, **kwargs: Any ) -> None: """ - :keyword type: Managed service identity (system assigned and/or user assigned identities). - Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, JSON] + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] """ super().__init__(**kwargs) - self.type = type - self.user_assigned_identities = user_assigned_identities + self.next_link = next_link + self.value = value -class PartialMinimalTrackedResource(_serialization.Model): - """Strictly used in update requests. +class RandomSamplingAlgorithm(SamplingAlgorithm): + """Defines a Sampling Algorithm that generates values randomly. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] + All required parameters must be populated in order to send to server. + + :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter + values, along with configuration properties. Required. Known values are: "Grid", "Random", and + "Bayesian". + :vartype sampling_algorithm_type: str or + ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType + :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. + :vartype seed: int """ + _validation = { + "sampling_algorithm_type": {"required": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, + "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, + "rule": {"key": "rule", "type": "str"}, + "seed": {"key": "seed", "type": "int"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + rule: Optional[Union[str, "_models.RandomSamplingAlgorithmRule"]] = None, + seed: Optional[int] = None, + **kwargs: Any + ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, 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. + :paramtype seed: int """ super().__init__(**kwargs) - self.tags = tags + self.sampling_algorithm_type: str = "Random" + self.rule = rule + self.seed = seed -class PartialMinimalTrackedResourceWithIdentity(PartialMinimalTrackedResource): - """Strictly used in update requests. +class Recurrence(_serialization.Model): + """The workflow trigger recurrence for ComputeStartStop schedule type. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :ivar frequency: [Required] The frequency to trigger schedule. Known values are: "Minute", + "Hour", "Day", "Week", and "Month". + :vartype frequency: str or + ~azure.mgmt.machinelearningservices.models.ComputeRecurrenceFrequency + :ivar interval: [Required] Specifies schedule interval in conjunction with frequency. + :vartype interval: int + :ivar start_time: The start time in yyyy-MM-ddTHH:mm:ss format. + :vartype start_time: str + :ivar time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :vartype time_zone: str + :ivar schedule: [Required] The recurrence schedule. + :vartype schedule: ~azure.mgmt.machinelearningservices.models.ComputeRecurrenceSchedule """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "PartialManagedServiceIdentity"}, + "frequency": {"key": "frequency", "type": "str"}, + "interval": {"key": "interval", "type": "int"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "schedule": {"key": "schedule", "type": "ComputeRecurrenceSchedule"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.PartialManagedServiceIdentity"] = None, + frequency: Optional[Union[str, "_models.ComputeRecurrenceFrequency"]] = None, + interval: Optional[int] = None, + start_time: Optional[str] = None, + time_zone: str = "UTC", + schedule: Optional["_models.ComputeRecurrenceSchedule"] = None, **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: ~azure.mgmt.machinelearningservices.models.PartialManagedServiceIdentity + :keyword frequency: [Required] The frequency to trigger schedule. Known values are: "Minute", + "Hour", "Day", "Week", and "Month". + :paramtype frequency: str or + ~azure.mgmt.machinelearningservices.models.ComputeRecurrenceFrequency + :keyword interval: [Required] Specifies schedule interval in conjunction with frequency. + :paramtype interval: int + :keyword start_time: The start time in yyyy-MM-ddTHH:mm:ss format. + :paramtype start_time: str + :keyword time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :paramtype time_zone: str + :keyword schedule: [Required] The recurrence schedule. + :paramtype schedule: ~azure.mgmt.machinelearningservices.models.ComputeRecurrenceSchedule """ - super().__init__(tags=tags, **kwargs) - self.identity = identity + super().__init__(**kwargs) + self.frequency = frequency + self.interval = interval + self.start_time = start_time + self.time_zone = time_zone + self.schedule = schedule -class PartialMinimalTrackedResourceWithSku(PartialMinimalTrackedResource): - """Strictly used in update requests. +class RecurrenceSchedule(_serialization.Model): + """RecurrenceSchedule. - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + All required parameters must be populated in order to send to server. + + :ivar hours: [Required] List of hours for the schedule. Required. + :vartype hours: list[int] + :ivar minutes: [Required] List of minutes for the schedule. Required. + :vartype minutes: list[int] + :ivar month_days: List of month days for the schedule. + :vartype month_days: list[int] + :ivar week_days: List of days for the schedule. + :vartype week_days: list[str or ~azure.mgmt.machinelearningservices.models.WeekDay] """ + _validation = { + "hours": {"required": True}, + "minutes": {"required": True}, + } + _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "PartialSku"}, + "hours": {"key": "hours", "type": "[int]"}, + "minutes": {"key": "minutes", "type": "[int]"}, + "month_days": {"key": "monthDays", "type": "[int]"}, + "week_days": {"key": "weekDays", "type": "[str]"}, } def __init__( - self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.PartialSku"] = None, **kwargs: Any + self, + *, + hours: List[int], + minutes: List[int], + month_days: Optional[List[int]] = None, + week_days: Optional[List[Union[str, "_models.WeekDay"]]] = None, + **kwargs: Any ) -> None: """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.PartialSku + :keyword hours: [Required] List of hours for the schedule. Required. + :paramtype hours: list[int] + :keyword minutes: [Required] List of minutes for the schedule. Required. + :paramtype minutes: list[int] + :keyword month_days: List of month days for the schedule. + :paramtype month_days: list[int] + :keyword week_days: List of days for the schedule. + :paramtype week_days: list[str or ~azure.mgmt.machinelearningservices.models.WeekDay] """ - super().__init__(tags=tags, **kwargs) - self.sku = sku + super().__init__(**kwargs) + self.hours = hours + self.minutes = minutes + self.month_days = month_days + self.week_days = week_days -class PartialRegistryPartialTrackedResource(_serialization.Model): - """Strictly used in update requests. +class RecurrenceTrigger(TriggerBase): + """RecurrenceTrigger. - :ivar identity: Managed service identity (system assigned and/or user assigned identities). - :vartype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :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] + All required parameters must be populated in order to send to server. + + :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :vartype end_time: str + :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :vartype start_time: str + :ivar time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :vartype time_zone: str + :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". + :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType + :ivar frequency: [Required] The frequency to trigger schedule. Required. Known values are: + "Minute", "Hour", "Day", "Week", and "Month". + :vartype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency + :ivar interval: [Required] Specifies schedule interval in conjunction with frequency. Required. + :vartype interval: int + :ivar schedule: The recurrence schedule. + :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule """ + _validation = { + "trigger_type": {"required": True}, + "frequency": {"required": True}, + "interval": {"required": True}, + } + _attribute_map = { - "identity": {"key": "identity", "type": "RegistryPartialManagedServiceIdentity"}, - "sku": {"key": "sku", "type": "PartialSku"}, - "tags": {"key": "tags", "type": "{str}"}, + "end_time": {"key": "endTime", "type": "str"}, + "start_time": {"key": "startTime", "type": "str"}, + "time_zone": {"key": "timeZone", "type": "str"}, + "trigger_type": {"key": "triggerType", "type": "str"}, + "frequency": {"key": "frequency", "type": "str"}, + "interval": {"key": "interval", "type": "int"}, + "schedule": {"key": "schedule", "type": "RecurrenceSchedule"}, } def __init__( self, *, - identity: Optional["_models.RegistryPartialManagedServiceIdentity"] = None, - sku: Optional["_models.PartialSku"] = None, - tags: Optional[Dict[str, str]] = None, + frequency: Union[str, "_models.RecurrenceFrequency"], + interval: int, + end_time: Optional[str] = None, + start_time: Optional[str] = None, + time_zone: str = "UTC", + schedule: Optional["_models.RecurrenceSchedule"] = None, **kwargs: Any ) -> None: """ - :keyword identity: Managed service identity (system assigned and/or user assigned identities). - :paramtype identity: - ~azure.mgmt.machinelearningservices.models.RegistryPartialManagedServiceIdentity - :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] + :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer + https://en.wikipedia.org/wiki/ISO_8601. + Recommented format would be "2022-06-01T00:00:01" + If not present, the schedule will run indefinitely. + :paramtype end_time: str + :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC + offset. + :paramtype start_time: str + :keyword time_zone: Specifies time zone in which the schedule runs. + TimeZone should follow Windows time zone format. Refer: + https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. + :paramtype time_zone: str + :keyword frequency: [Required] The frequency to trigger schedule. Required. Known values are: + "Minute", "Hour", "Day", "Week", and "Month". + :paramtype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency + :keyword interval: [Required] Specifies schedule interval in conjunction with frequency. + Required. + :paramtype interval: int + :keyword schedule: The recurrence schedule. + :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule """ - super().__init__(**kwargs) - self.identity = identity - self.sku = sku - self.tags = tags + super().__init__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) + self.trigger_type: str = "Recurrence" + self.frequency = frequency + self.interval = interval + self.schedule = schedule -class PartialSku(_serialization.Model): - """Common SKU definition. +class RegenerateEndpointKeysRequest(_serialization.Model): + """RegenerateEndpointKeysRequest. - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :vartype name: str - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + All required parameters must be populated in order to send to server. + + :ivar key_type: [Required] Specification for which type of key to generate. Primary or + Secondary. Required. Known values are: "Primary" and "Secondary". + :vartype key_type: str or ~azure.mgmt.machinelearningservices.models.KeyType + :ivar key_value: The value the key is set to. + :vartype key_value: str """ + _validation = { + "key_type": {"required": True}, + } + _attribute_map = { - "capacity": {"key": "capacity", "type": "int"}, - "family": {"key": "family", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, + "key_type": {"key": "keyType", "type": "str"}, + "key_value": {"key": "keyValue", "type": "str"}, } def __init__( - self, - *, - capacity: Optional[int] = None, - family: Optional[str] = None, - name: Optional[str] = None, - size: Optional[str] = None, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - **kwargs: Any + self, *, key_type: Union[str, "_models.KeyType"], key_value: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :paramtype name: str - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :keyword key_type: [Required] Specification for which type of key to generate. Primary or + Secondary. Required. Known values are: "Primary" and "Secondary". + :paramtype key_type: str or ~azure.mgmt.machinelearningservices.models.KeyType + :keyword key_value: The value the key is set to. + :paramtype key_value: str + """ + super().__init__(**kwargs) + self.key_type = key_type + self.key_value = key_value + + +class RegenerateServiceAccountKeyContent(_serialization.Model): + """RegenerateServiceAccountKeyContent. + + :ivar key_name: Known values are: "Key1" and "Key2". + :vartype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName + """ + + _attribute_map = { + "key_name": {"key": "keyName", "type": "str"}, + } + + def __init__( + self, *, key_name: Optional[Union[str, "_models.ServiceAccountKeyName"]] = None, **kwargs: Any + ) -> None: + """ + :keyword key_name: Known values are: "Key1" and "Key2". + :paramtype key_name: str or ~azure.mgmt.machinelearningservices.models.ServiceAccountKeyName """ super().__init__(**kwargs) - self.capacity = capacity - self.family = family - self.name = name - self.size = size - self.tier = tier + self.key_name = key_name -class Password(_serialization.Model): - """Password. +class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes + """Registry. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar value: - :vartype value: 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 sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku + :ivar discovery_url: Discovery URL for the Registry. + :vartype discovery_url: str + :ivar intellectual_property_publisher: IntellectualPropertyPublisher for the registry. + :vartype intellectual_property_publisher: str + :ivar managed_resource_group: ResourceId of the managed RG if the registry has system created + resources. + :vartype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :ivar managed_resource_group_settings: Managed resource group specific settings. + :vartype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings + :ivar ml_flow_registry_uri: MLFlow Registry URI for the Registry. + :vartype ml_flow_registry_uri: str + :ivar registry_private_endpoint_connections: Private endpoint connections info used for pending + connections in private link portal. + :vartype registry_private_endpoint_connections: + list[~azure.mgmt.machinelearningservices.models.RegistryPrivateEndpointConnection] + :ivar public_network_access: Is the Registry accessible from the internet? + Possible values: "Enabled" or "Disabled". + :vartype public_network_access: str + :ivar region_details: Details of each region the registry is in. + :vartype region_details: + list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] """ _validation = { + "id": {"readonly": True}, "name": {"readonly": True}, - "value": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "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"}, + "sku": {"key": "sku", "type": "Sku"}, + "discovery_url": {"key": "properties.discoveryUrl", "type": "str"}, + "intellectual_property_publisher": {"key": "properties.intellectualPropertyPublisher", "type": "str"}, + "managed_resource_group": {"key": "properties.managedResourceGroup", "type": "ArmResourceId"}, + "managed_resource_group_settings": { + "key": "properties.managedResourceGroupSettings", + "type": "ManagedResourceGroupSettings", + }, + "ml_flow_registry_uri": {"key": "properties.mlFlowRegistryUri", "type": "str"}, + "registry_private_endpoint_connections": { + "key": "properties.registryPrivateEndpointConnections", + "type": "[RegistryPrivateEndpointConnection]", + }, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "region_details": {"key": "properties.regionDetails", "type": "[RegistryRegionArmDetails]"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + discovery_url: Optional[str] = None, + intellectual_property_publisher: Optional[str] = None, + managed_resource_group: Optional["_models.ArmResourceId"] = None, + managed_resource_group_settings: Optional["_models.ManagedResourceGroupSettings"] = None, + ml_flow_registry_uri: Optional[str] = None, + registry_private_endpoint_connections: Optional[List["_models.RegistryPrivateEndpointConnection"]] = None, + public_network_access: Optional[str] = None, + region_details: Optional[List["_models.RegistryRegionArmDetails"]] = None, + **kwargs: Any + ) -> None: + """ + :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 sku: Sku details required for ARM contract for Autoscaling. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku + :keyword discovery_url: Discovery URL for the Registry. + :paramtype discovery_url: str + :keyword intellectual_property_publisher: IntellectualPropertyPublisher for the registry. + :paramtype intellectual_property_publisher: str + :keyword managed_resource_group: ResourceId of the managed RG if the registry has system + created resources. + :paramtype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId + :keyword managed_resource_group_settings: Managed resource group specific settings. + :paramtype managed_resource_group_settings: + ~azure.mgmt.machinelearningservices.models.ManagedResourceGroupSettings + :keyword ml_flow_registry_uri: MLFlow Registry URI for the Registry. + :paramtype ml_flow_registry_uri: str + :keyword registry_private_endpoint_connections: Private endpoint connections info used for + pending connections in private link portal. + :paramtype registry_private_endpoint_connections: + list[~azure.mgmt.machinelearningservices.models.RegistryPrivateEndpointConnection] + :keyword public_network_access: Is the Registry accessible from the internet? + Possible values: "Enabled" or "Disabled". + :paramtype public_network_access: str + :keyword region_details: Details of each region the registry is in. + :paramtype region_details: + list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] + """ + super().__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.kind = kind + self.sku = sku + self.discovery_url = discovery_url + self.intellectual_property_publisher = intellectual_property_publisher + self.managed_resource_group = managed_resource_group + self.managed_resource_group_settings = managed_resource_group_settings + self.ml_flow_registry_uri = ml_flow_registry_uri + self.registry_private_endpoint_connections = registry_private_endpoint_connections + self.public_network_access = public_network_access + self.region_details = region_details -class PATAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """PATAuthTypeWorkspaceConnectionProperties. +class RegistryListCredentialsResult(_serialization.Model): + """RegistryListCredentialsResult. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :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 - :ivar credentials: - :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken + :ivar location: The location of the workspace ACR. + :vartype location: str + :ivar passwords: + :vartype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :ivar username: The username of the workspace ACR. + :vartype username: str """ _validation = { - "auth_type": {"required": True}, + "location": {"readonly": True}, + "username": {"readonly": 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": "WorkspaceConnectionPersonalAccessToken"}, + "location": {"key": "location", "type": "str"}, + "passwords": {"key": "passwords", "type": "[Password]"}, + "username": {"key": "username", "type": "str"}, } - 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.WorkspaceConnectionPersonalAccessToken"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, passwords: Optional[List["_models.Password"]] = None, **kwargs: Any) -> None: """ - :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 - :keyword credentials: - :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPersonalAccessToken + :keyword passwords: + :paramtype passwords: list[~azure.mgmt.machinelearningservices.models.Password] """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "PAT" - self.credentials = credentials + super().__init__(**kwargs) + self.location = None + self.passwords = passwords + self.username = None -class PendingUploadCredentialDto(_serialization.Model): - """PendingUploadCredentialDto. +class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): + """Managed service identity (system assigned and/or user assigned identities). - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - SASCredentialDto + 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. + All required parameters must be populated in order to send to server. - :ivar credential_type: [Required] Credential type used to authentication with storage. - Required. "SAS" - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] """ - _validation = { - "credential_type": {"required": True}, - } + +class RegistryPrivateEndpointConnection(_serialization.Model): + """Private endpoint connection definition. + + :ivar id: This is the private endpoint connection name created on SRP + Full resource id: + /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.MachineLearningServices/{resourceType}/{resourceName}/registryPrivateEndpointConnections/{peConnectionName}. # pylint: disable=line-too-long + :vartype id: str + :ivar location: Same as workspace location. + :vartype location: str + :ivar group_ids: The group ids. + :vartype group_ids: list[str] + :ivar private_endpoint: The PE network resource that is linked to this PE connection. + :vartype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpointResource + :ivar registry_private_link_service_connection_state: The connection state. + :vartype registry_private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.RegistryPrivateLinkServiceConnectionState + :ivar provisioning_state: One of null, "Succeeded", "Provisioning", "Failed". While not + approved, it's null. + :vartype provisioning_state: str + """ _attribute_map = { - "credential_type": {"key": "credentialType", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "group_ids": {"key": "properties.groupIds", "type": "[str]"}, + "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointResource"}, + "registry_private_link_service_connection_state": { + "key": "properties.registryPrivateLinkServiceConnectionState", + "type": "RegistryPrivateLinkServiceConnectionState", + }, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, } - _subtype_map = {"credential_type": {"SAS": "SASCredentialDto"}} - - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + location: Optional[str] = None, + group_ids: Optional[List[str]] = None, + private_endpoint: Optional["_models.PrivateEndpointResource"] = None, + registry_private_link_service_connection_state: Optional[ + "_models.RegistryPrivateLinkServiceConnectionState" + ] = None, + provisioning_state: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: This is the private endpoint connection name created on SRP + Full resource id: + /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.MachineLearningServices/{resourceType}/{resourceName}/registryPrivateEndpointConnections/{peConnectionName}. # pylint: disable=line-too-long + :paramtype id: str + :keyword location: Same as workspace location. + :paramtype location: str + :keyword group_ids: The group ids. + :paramtype group_ids: list[str] + :keyword private_endpoint: The PE network resource that is linked to this PE connection. + :paramtype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpointResource + :keyword registry_private_link_service_connection_state: The connection state. + :paramtype registry_private_link_service_connection_state: + ~azure.mgmt.machinelearningservices.models.RegistryPrivateLinkServiceConnectionState + :keyword provisioning_state: One of null, "Succeeded", "Provisioning", "Failed". While not + approved, it's null. + :paramtype provisioning_state: str + """ super().__init__(**kwargs) - self.credential_type: Optional[str] = None + self.id = id + self.location = location + self.group_ids = group_ids + self.private_endpoint = private_endpoint + self.registry_private_link_service_connection_state = registry_private_link_service_connection_state + self.provisioning_state = provisioning_state -class PendingUploadRequestDto(_serialization.Model): - """PendingUploadRequestDto. +class RegistryPrivateLinkServiceConnectionState(_serialization.Model): # pylint: disable=name-too-long + """The connection state. - :ivar pending_upload_id: If PendingUploadId = null then random guid will be used. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Known values are: - "None" and "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :ivar actions_required: Some RP chose "None". Other RPs use this for region expansion. + :vartype actions_required: str + :ivar description: User-defined message that, per NRP doc, may be used for approval-related + message. + :vartype description: str + :ivar status: Connection status of the service consumer with the service provider. Known values + are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :vartype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { - "pending_upload_id": {"key": "pendingUploadId", "type": "str"}, - "pending_upload_type": {"key": "pendingUploadType", "type": "str"}, + "actions_required": {"key": "actionsRequired", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "status": {"key": "status", "type": "str"}, } def __init__( self, *, - pending_upload_id: Optional[str] = None, - pending_upload_type: Optional[Union[str, "_models.PendingUploadType"]] = None, + actions_required: Optional[str] = None, + description: Optional[str] = None, + status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = None, **kwargs: Any ) -> None: """ - :keyword pending_upload_id: If PendingUploadId = null then random guid will be used. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Known values - are: "None" and "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :keyword actions_required: Some RP chose "None". Other RPs use this for region expansion. + :paramtype actions_required: str + :keyword description: User-defined message that, per NRP doc, may be used for approval-related + message. + :paramtype description: str + :keyword status: Connection status of the service consumer with the service provider. Known + values are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :paramtype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ super().__init__(**kwargs) - self.pending_upload_id = pending_upload_id - self.pending_upload_type = pending_upload_type + self.actions_required = actions_required + self.description = description + self.status = status -class PendingUploadResponseDto(_serialization.Model): - """PendingUploadResponseDto. +class RegistryRegionArmDetails(_serialization.Model): + """Details for each region the registry is in. - :ivar blob_reference_for_consumption: Container level read, write, list SAS. - :vartype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :ivar pending_upload_id: ID for this upload request. - :vartype pending_upload_id: str - :ivar pending_upload_type: TemporaryBlobReference is the only supported type. Known values are: - "None" and "TemporaryBlobReference". - :vartype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :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 = { - "blob_reference_for_consumption": { - "key": "blobReferenceForConsumption", - "type": "BlobReferenceForConsumptionDto", - }, - "pending_upload_id": {"key": "pendingUploadId", "type": "str"}, - "pending_upload_type": {"key": "pendingUploadType", "type": "str"}, + "acr_details": {"key": "acrDetails", "type": "[AcrDetails]"}, + "location": {"key": "location", "type": "str"}, + "storage_account_details": {"key": "storageAccountDetails", "type": "[StorageAccountDetails]"}, } def __init__( self, *, - blob_reference_for_consumption: Optional["_models.BlobReferenceForConsumptionDto"] = None, - pending_upload_id: Optional[str] = None, - pending_upload_type: Optional[Union[str, "_models.PendingUploadType"]] = None, + acr_details: Optional[List["_models.AcrDetails"]] = None, + location: Optional[str] = None, + storage_account_details: Optional[List["_models.StorageAccountDetails"]] = None, **kwargs: Any ) -> None: """ - :keyword blob_reference_for_consumption: Container level read, write, list SAS. - :paramtype blob_reference_for_consumption: - ~azure.mgmt.machinelearningservices.models.BlobReferenceForConsumptionDto - :keyword pending_upload_id: ID for this upload request. - :paramtype pending_upload_id: str - :keyword pending_upload_type: TemporaryBlobReference is the only supported type. Known values - are: "None" and "TemporaryBlobReference". - :paramtype pending_upload_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadType + :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.blob_reference_for_consumption = blob_reference_for_consumption - self.pending_upload_id = pending_upload_id - self.pending_upload_type = pending_upload_type + self.acr_details = acr_details + self.location = location + self.storage_account_details = storage_account_details -class PersonalComputeInstanceSettings(_serialization.Model): - """Settings for a personal compute instance. +class RegistryTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of Registry entities. - :ivar assigned_user: A user explicitly assigned to a personal compute instance. - :vartype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :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 = { - "assigned_user": {"key": "assignedUser", "type": "AssignedUser"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Registry]"}, } - def __init__(self, *, assigned_user: Optional["_models.AssignedUser"] = None, **kwargs: Any) -> None: + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Registry"]] = None, **kwargs: Any + ) -> None: """ - :keyword assigned_user: A user explicitly assigned to a personal compute instance. - :paramtype assigned_user: ~azure.mgmt.machinelearningservices.models.AssignedUser + :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.assigned_user = assigned_user - + self.next_link = next_link + self.value = value -class PipelineJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes - """Pipeline Job definition: defines generic to MFE attributes. - Variables are only populated by the server, and will be ignored when sending a request. +class Regression(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes + """Regression task in AutoML Table vertical. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :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", "Sweep", and "Pipeline". - :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". - :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] - :ivar jobs: Jobs construct the Pipeline Job. - :vartype jobs: dict[str, JSON] - :ivar outputs: Outputs for the pipeline job. - :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :ivar settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :vartype settings: JSON - :ivar source_job_id: ARM resource ID of source job. - :vartype source_job_id: str + :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :ivar target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :vartype target_column_name: str + :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: + "Classification", "Regression", "Forecasting", "ImageClassification", + "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", + "TextClassification", "TextClassificationMultilabel", and "TextNER". + :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType + :ivar training_data: [Required] Training data input. Required. + :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar cv_split_column_names: Columns to use for CVSplit data. + :vartype cv_split_column_names: list[str] + :ivar featurization_settings: Featurization inputs needed for AutoML job. + :vartype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :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 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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype test_data_size: float + :ivar validation_data: Validation data inputs. + :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :ivar validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :vartype validation_data_size: float + :ivar weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :vartype weight_column_name: str + :ivar primary_metric: Primary metric for regression task. Known values are: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and + "NormalizedMeanAbsoluteError". + :vartype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.RegressionPrimaryMetrics + :ivar training_settings: Inputs for training phase for an AutoML Job. + :vartype training_settings: + ~azure.mgmt.machinelearningservices.models.RegressionTrainingSettings """ _validation = { - "job_type": {"required": True}, - "status": {"readonly": True}, + "task_type": {"required": True}, + "training_data": {"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"}, - "inputs": {"key": "inputs", "type": "{JobInput}"}, - "jobs": {"key": "jobs", "type": "{object}"}, - "outputs": {"key": "outputs", "type": "{JobOutput}"}, - "settings": {"key": "settings", "type": "object"}, - "source_job_id": {"key": "sourceJobId", "type": "str"}, + "log_verbosity": {"key": "logVerbosity", "type": "str"}, + "target_column_name": {"key": "targetColumnName", "type": "str"}, + "task_type": {"key": "taskType", "type": "str"}, + "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, + "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, + "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, + "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, + "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, + "test_data": {"key": "testData", "type": "MLTableJobInput"}, + "test_data_size": {"key": "testDataSize", "type": "float"}, + "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, + "validation_data_size": {"key": "validationDataSize", "type": "float"}, + "weight_column_name": {"key": "weightColumnName", "type": "str"}, + "primary_metric": {"key": "primaryMetric", "type": "str"}, + "training_settings": {"key": "trainingSettings", "type": "RegressionTrainingSettings"}, } 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, - inputs: Optional[Dict[str, "_models.JobInput"]] = None, - jobs: Optional[Dict[str, JSON]] = None, - outputs: Optional[Dict[str, "_models.JobOutput"]] = None, - settings: Optional[JSON] = None, - source_job_id: Optional[str] = None, + training_data: "_models.MLTableJobInput", + log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, + target_column_name: Optional[str] = None, + cv_split_column_names: Optional[List[str]] = None, + featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, + limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, + n_cross_validations: Optional["_models.NCrossValidations"] = None, + test_data: Optional["_models.MLTableJobInput"] = None, + test_data_size: Optional[float] = None, + validation_data: Optional["_models.MLTableJobInput"] = None, + validation_data_size: Optional[float] = None, + weight_column_name: Optional[str] = None, + primary_metric: Optional[Union[str, "_models.RegressionPrimaryMetrics"]] = None, + training_settings: Optional["_models.RegressionTrainingSettings"] = None, **kwargs: Any ) -> None: """ - :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 inputs: Inputs for the pipeline job. - :paramtype inputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobInput] - :keyword jobs: Jobs construct the Pipeline Job. - :paramtype jobs: dict[str, JSON] - :keyword outputs: Outputs for the pipeline job. - :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] - :keyword settings: Pipeline settings, for things like ContinueRunOnStepFailure etc. - :paramtype settings: JSON - :keyword source_job_id: ARM resource ID of source job. - :paramtype source_job_id: str + :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", + "Warning", "Error", and "Critical". + :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity + :keyword target_column_name: Target column name: This is prediction values column. + Also known as label column name in context of classification tasks. + :paramtype target_column_name: str + :keyword training_data: [Required] Training data input. Required. + :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword cv_split_column_names: Columns to use for CVSplit data. + :paramtype cv_split_column_names: list[str] + :keyword featurization_settings: Featurization inputs needed for AutoML job. + :paramtype featurization_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings + :keyword limit_settings: Execution constraints for AutoMLJob. + :paramtype limit_settings: + ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings + :keyword n_cross_validations: Number of cross validation folds to be applied on training + dataset + when validation dataset is not provided. + :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations + :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 + purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype test_data_size: float + :keyword validation_data: Validation data inputs. + :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput + :keyword validation_data_size: The fraction of training dataset that needs to be set aside for + validation purpose. + Values between (0.0 , 1.0) + Applied when validation dataset is not provided. + :paramtype validation_data_size: float + :keyword weight_column_name: The name of the sample weight column. Automated ML supports a + weighted column as an input, causing rows in the data to be weighted up or down. + :paramtype weight_column_name: str + :keyword primary_metric: Primary metric for regression task. Known values are: + "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and + "NormalizedMeanAbsoluteError". + :paramtype primary_metric: str or + ~azure.mgmt.machinelearningservices.models.RegressionPrimaryMetrics + :keyword training_settings: Inputs for training phase for an AutoML Job. + :paramtype training_settings: + ~azure.mgmt.machinelearningservices.models.RegressionTrainingSettings """ 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, + cv_split_column_names=cv_split_column_names, + featurization_settings=featurization_settings, + limit_settings=limit_settings, + n_cross_validations=n_cross_validations, + test_data=test_data, + test_data_size=test_data_size, + validation_data=validation_data, + validation_data_size=validation_data_size, + weight_column_name=weight_column_name, + log_verbosity=log_verbosity, + target_column_name=target_column_name, + training_data=training_data, **kwargs ) - self.job_type: str = "Pipeline" - self.inputs = inputs - self.jobs = jobs - self.outputs = outputs - self.settings = settings - self.source_job_id = source_job_id - - -class PrivateEndpoint(_serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): # pylint: disable=too-many-instance-attributes - """The Private Endpoint Connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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 identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar private_endpoint: The resource of private end point. - :vartype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :ivar private_link_service_connection_state: A collection of information about the state of the - connection between service consumer and provider. - :vartype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of the private endpoint connection resource. - Known values are: "Succeeded", "Creating", "Deleting", and "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnectionProvisioningState - """ + self.log_verbosity = log_verbosity + self.target_column_name = target_column_name + self.task_type: str = "Regression" + self.training_data = training_data + self.primary_metric = primary_metric + self.training_settings = training_settings + self.cv_split_column_names = cv_split_column_names + self.featurization_settings = featurization_settings + self.limit_settings = limit_settings + self.n_cross_validations = n_cross_validations + self.test_data = test_data + self.test_data_size = test_data_size + self.validation_data = validation_data + self.validation_data_size = validation_data_size + self.weight_column_name = weight_column_name - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } + +class RegressionTrainingSettings(TrainingSettings): + """Regression Training related configuration. + + :ivar enable_dnn_training: Enable recommendation of DNN models. + :vartype enable_dnn_training: bool + :ivar enable_model_explainability: Flag to turn on explainability on best model. + :vartype enable_model_explainability: bool + :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :vartype enable_onnx_compatible_models: bool + :ivar enable_stack_ensemble: Enable stack ensemble run. + :vartype enable_stack_ensemble: bool + :ivar enable_vote_ensemble: Enable voting ensemble run. + :vartype enable_vote_ensemble: bool + :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :vartype ensemble_model_download_timeout: ~datetime.timedelta + :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :vartype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :ivar allowed_training_algorithms: Allowed models for regression task. + :vartype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] + :ivar blocked_training_algorithms: Blocked models for regression task. + :vartype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] + """ _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "properties.privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, + "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, + "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, + "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, + "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, + "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, + "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, + "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, + "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, } def __init__( self, *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - private_endpoint: Optional["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + enable_dnn_training: bool = False, + enable_model_explainability: bool = True, + enable_onnx_compatible_models: bool = False, + enable_stack_ensemble: bool = True, + enable_vote_ensemble: bool = True, + ensemble_model_download_timeout: datetime.timedelta = "PT5M", + stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, + allowed_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, + blocked_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, **kwargs: Any ) -> None: """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword private_endpoint: The resource of private end point. - :paramtype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpoint - :keyword private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :paramtype private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.identity = identity - self.location = location - self.tags = tags - self.sku = sku - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """List of private endpoint connection associated with the specified workspace. - - :ivar value: Array of private endpoint connections. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - } - - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: - """ - :keyword value: Array of private endpoint connections. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] - """ - super().__init__(**kwargs) - self.value = value - - -class PrivateEndpointResource(PrivateEndpoint): - """The PE network resource that is linked to this PE connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. - :vartype subnet_arm_id: str - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, - } - - def __init__(self, *, subnet_arm_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_arm_id: The subnetId that the private endpoint is connected to. - :paramtype subnet_arm_id: str + :keyword enable_dnn_training: Enable recommendation of DNN models. + :paramtype enable_dnn_training: bool + :keyword enable_model_explainability: Flag to turn on explainability on best model. + :paramtype enable_model_explainability: bool + :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. + :paramtype enable_onnx_compatible_models: bool + :keyword enable_stack_ensemble: Enable stack ensemble run. + :paramtype enable_stack_ensemble: bool + :keyword enable_vote_ensemble: Enable voting ensemble run. + :paramtype enable_vote_ensemble: bool + :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model + generation, multiple fitted models from the previous child runs are downloaded. + Configure this parameter with a higher value than 300 secs, if more time is needed. + :paramtype ensemble_model_download_timeout: ~datetime.timedelta + :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. + :paramtype stack_ensemble_settings: + ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings + :keyword allowed_training_algorithms: Allowed models for regression task. + :paramtype allowed_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] + :keyword blocked_training_algorithms: Blocked models for regression task. + :paramtype blocked_training_algorithms: list[str or + ~azure.mgmt.machinelearningservices.models.RegressionModels] """ - super().__init__(**kwargs) - self.subnet_arm_id = subnet_arm_id - + super().__init__( + enable_dnn_training=enable_dnn_training, + enable_model_explainability=enable_model_explainability, + enable_onnx_compatible_models=enable_onnx_compatible_models, + enable_stack_ensemble=enable_stack_ensemble, + enable_vote_ensemble=enable_vote_ensemble, + ensemble_model_download_timeout=ensemble_model_download_timeout, + stack_ensemble_settings=stack_ensemble_settings, + **kwargs + ) + self.allowed_training_algorithms = allowed_training_algorithms + self.blocked_training_algorithms = blocked_training_algorithms -class PrivateLinkResource(Resource): # pylint: disable=too-many-instance-attributes - """A private link resource. - Variables are only populated by the server, and will be ignored when sending a request. +class RequestConfiguration(_serialization.Model): + """Scoring requests configuration. - :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 identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. - :vartype location: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] + :ivar max_concurrent_requests_per_instance: The number of maximum concurrent requests per node + allowed per deployment. Defaults to 1. + :vartype max_concurrent_requests_per_instance: int + :ivar request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :vartype request_timeout: ~datetime.timedelta """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - } - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "required_members": {"key": "properties.requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, + "max_concurrent_requests_per_instance": {"key": "maxConcurrentRequestsPerInstance", "type": "int"}, + "request_timeout": {"key": "requestTimeout", "type": "duration"}, } def __init__( self, *, - identity: Optional["_models.ManagedServiceIdentity"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - required_zone_names: Optional[List[str]] = None, + max_concurrent_requests_per_instance: int = 1, + request_timeout: datetime.timedelta = "PT5S", **kwargs: Any ) -> None: """ - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. - :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword required_zone_names: The private link resource Private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.identity = identity - self.location = location - self.tags = tags - self.sku = sku - self.group_id = None - self.required_members = None - self.required_zone_names = required_zone_names + :keyword max_concurrent_requests_per_instance: The number of maximum concurrent requests per + node allowed per deployment. Defaults to 1. + :paramtype max_concurrent_requests_per_instance: int + :keyword request_timeout: The scoring timeout in ISO 8601 format. + Defaults to 5000ms. + :paramtype request_timeout: ~datetime.timedelta + """ + super().__init__(**kwargs) + self.max_concurrent_requests_per_instance = max_concurrent_requests_per_instance + self.request_timeout = request_timeout -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. +class RequestLogging(_serialization.Model): + """RequestLogging. - :ivar value: Array of private link resources. - :vartype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :ivar capture_headers: For payload logging, we only collect payload by default. If customers + also want to collect the specified headers, they can set them in captureHeaders so that backend + will collect those headers along with payload. + :vartype capture_headers: list[str] """ _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, + "capture_headers": {"key": "captureHeaders", "type": "[str]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: + def __init__(self, *, capture_headers: Optional[List[str]] = None, **kwargs: Any) -> None: """ - :keyword value: Array of private link resources. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] + :keyword capture_headers: For payload logging, we only collect payload by default. If customers + also want to collect the specified headers, they can set them in captureHeaders so that backend + will collect those headers along with payload. + :paramtype capture_headers: list[str] """ super().__init__(**kwargs) - self.value = value + self.capture_headers = capture_headers -class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and - provider. +class ResizeSchema(_serialization.Model): + """Schema for Compute Instance resize. - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", "Rejected", "Disconnected", and - "Timeout". - :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :ivar description: The reason for approval/rejection of the connection. - :vartype description: str - :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :vartype actions_required: str + :ivar target_vm_size: The name of the virtual machine size. + :vartype target_vm_size: str """ _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, + "target_vm_size": {"key": "targetVMSize", "type": "str"}, } - def __init__( - self, - *, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[str] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, target_vm_size: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", "Rejected", "Disconnected", and - "Timeout". - :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - :keyword description: The reason for approval/rejection of the connection. - :paramtype description: str - :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :paramtype actions_required: str + :keyword target_vm_size: The name of the virtual machine size. + :paramtype target_vm_size: str """ super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required + self.target_vm_size = target_vm_size -class ProbeSettings(_serialization.Model): - """Deployment container liveness/readiness probe configuration. +class ResourceId(_serialization.Model): + """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. - :ivar failure_threshold: The number of failures to allow before returning an unhealthy status. - :vartype failure_threshold: int - :ivar initial_delay: The delay before the first probe in ISO 8601 format. - :vartype initial_delay: ~datetime.timedelta - :ivar period: The length of time between probes in ISO 8601 format. - :vartype period: ~datetime.timedelta - :ivar success_threshold: The number of successful probes before returning a healthy status. - :vartype success_threshold: int - :ivar timeout: The probe timeout in ISO 8601 format. - :vartype timeout: ~datetime.timedelta + All required parameters must be populated in order to send to server. + + :ivar id: The ID of the resource. Required. + :vartype id: str """ + _validation = { + "id": {"required": True}, + } + _attribute_map = { - "failure_threshold": {"key": "failureThreshold", "type": "int"}, - "initial_delay": {"key": "initialDelay", "type": "duration"}, - "period": {"key": "period", "type": "duration"}, - "success_threshold": {"key": "successThreshold", "type": "int"}, - "timeout": {"key": "timeout", "type": "duration"}, + "id": {"key": "id", "type": "str"}, } - def __init__( - self, - *, - failure_threshold: int = 30, - initial_delay: Optional[datetime.timedelta] = None, - period: datetime.timedelta = "PT10S", - success_threshold: int = 1, - timeout: datetime.timedelta = "PT2S", - **kwargs: Any - ) -> None: + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin """ - :keyword failure_threshold: The number of failures to allow before returning an unhealthy - status. - :paramtype failure_threshold: int - :keyword initial_delay: The delay before the first probe in ISO 8601 format. - :paramtype initial_delay: ~datetime.timedelta - :keyword period: The length of time between probes in ISO 8601 format. - :paramtype period: ~datetime.timedelta - :keyword success_threshold: The number of successful probes before returning a healthy status. - :paramtype success_threshold: int - :keyword timeout: The probe timeout in ISO 8601 format. - :paramtype timeout: ~datetime.timedelta + :keyword id: The ID of the resource. Required. + :paramtype id: str """ super().__init__(**kwargs) - self.failure_threshold = failure_threshold - self.initial_delay = initial_delay - self.period = period - self.success_threshold = success_threshold - self.timeout = timeout + self.id = id -class PyTorch(DistributionConfiguration): - """PyTorch distribution configuration. +class ResourceName(_serialization.Model): + """The Resource Name. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. - Known values are: "PyTorch", "TensorFlow", and "Mpi". - :vartype distribution_type: str or ~azure.mgmt.machinelearningservices.models.DistributionType - :ivar process_count_per_instance: Number of processes per node. - :vartype process_count_per_instance: int + :ivar value: The name of the resource. + :vartype value: str + :ivar localized_value: The localized name of the resource. + :vartype localized_value: str """ _validation = { - "distribution_type": {"required": True}, + "value": {"readonly": True}, + "localized_value": {"readonly": True}, } _attribute_map = { - "distribution_type": {"key": "distributionType", "type": "str"}, - "process_count_per_instance": {"key": "processCountPerInstance", "type": "int"}, + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, } - def __init__(self, *, process_count_per_instance: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword process_count_per_instance: Number of processes per node. - :paramtype process_count_per_instance: int - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.distribution_type: str = "PyTorch" - self.process_count_per_instance = process_count_per_instance + self.value = None + self.localized_value = None -class QuotaBaseProperties(_serialization.Model): - """The properties for Quota update or retrieval. +class ResourceQuota(_serialization.Model): + """The quota assigned to a resource. + + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Specifies the resource ID. :vartype id: str + :ivar aml_workspace_location: Region of the AML workspace in the id. + :vartype aml_workspace_location: str :ivar type: Specifies the resource type. :vartype type: str + :ivar name: Name of the resource. + :vartype name: ~azure.mgmt.machinelearningservices.models.ResourceName :ivar limit: The maximum permitted quota of the resource. :vartype limit: int :ivar unit: An enum describing the unit of quota measurement. "Count" :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit """ + _validation = { + "id": {"readonly": True}, + "aml_workspace_location": {"readonly": True}, + "type": {"readonly": True}, + "name": {"readonly": True}, + "limit": {"readonly": True}, + "unit": {"readonly": True}, + } + _attribute_map = { "id": {"key": "id", "type": "str"}, + "aml_workspace_location": {"key": "amlWorkspaceLocation", "type": "str"}, "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "ResourceName"}, "limit": {"key": "limit", "type": "int"}, "unit": {"key": "unit", "type": "str"}, } + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.aml_workspace_location = None + self.type = None + self.name = None + self.limit = None + self.unit = None + + +class RollingInputData(MonitoringInputDataBase): + """Rolling input data definition. + + All required parameters must be populated in order to send to server. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: [Required] Specifies the type of signal to monitor. Required. Known + values are: "Static", "Rolling", and "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + :ivar preprocessing_component_id: Reference to the component asset used to preprocess the data. + :vartype preprocessing_component_id: str + :ivar window_offset: [Required] The time offset between the end of the data window and the + monitor's current run time. Required. + :vartype window_offset: ~datetime.timedelta + :ivar window_size: [Required] The size of the rolling data window. Required. + :vartype window_size: ~datetime.timedelta + """ + + _validation = { + "input_data_type": {"required": True}, + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "window_offset": {"required": True}, + "window_size": {"required": True}, + } + + _attribute_map = { + "columns": {"key": "columns", "type": "{str}"}, + "data_context": {"key": "dataContext", "type": "str"}, + "input_data_type": {"key": "inputDataType", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "preprocessing_component_id": {"key": "preprocessingComponentId", "type": "str"}, + "window_offset": {"key": "windowOffset", "type": "duration"}, + "window_size": {"key": "windowSize", "type": "duration"}, + } + def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - type: Optional[str] = None, - limit: Optional[int] = None, - unit: Optional[Union[str, "_models.QuotaUnit"]] = None, + job_input_type: Union[str, "_models.JobInputType"], + uri: str, + window_offset: datetime.timedelta, + window_size: datetime.timedelta, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + preprocessing_component_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword id: Specifies the resource ID. - :paramtype id: str - :keyword type: Specifies the resource type. - :paramtype type: str - :keyword limit: The maximum permitted quota of the resource. - :paramtype limit: int - :keyword unit: An enum describing the unit of quota measurement. "Count" - :paramtype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + :keyword preprocessing_component_id: Reference to the component asset used to preprocess the + data. + :paramtype preprocessing_component_id: str + :keyword window_offset: [Required] The time offset between the end of the data window and the + monitor's current run time. Required. + :paramtype window_offset: ~datetime.timedelta + :keyword window_size: [Required] The size of the rolling data window. Required. + :paramtype window_size: ~datetime.timedelta + """ + super().__init__(columns=columns, data_context=data_context, job_input_type=job_input_type, uri=uri, **kwargs) + self.input_data_type: str = "Rolling" + self.preprocessing_component_id = preprocessing_component_id + self.window_offset = window_offset + self.window_size = window_size + + +class Route(_serialization.Model): + """Route. + + All required parameters must be populated in order to send to server. + + :ivar path: [Required] The path for the route. Required. + :vartype path: str + :ivar port: [Required] The port for the route. Required. + :vartype port: int + """ + + _validation = { + "path": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "port": {"required": True}, + } + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "port": {"key": "port", "type": "int"}, + } + + def __init__(self, *, path: str, port: int, **kwargs: Any) -> None: + """ + :keyword path: [Required] The path for the route. Required. + :paramtype path: str + :keyword port: [Required] The port for the route. Required. + :paramtype port: int """ super().__init__(**kwargs) - self.id = id - self.type = type - self.limit = limit - self.unit = unit + self.path = path + self.port = port -class QuotaUpdateParameters(_serialization.Model): - """Quota update parameters. +class SASAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes + """SASAuthTypeWorkspaceConnectionProperties. - :ivar value: The list for update quota. - :vartype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :ivar location: Region of workspace quota to be updated. - :vartype location: str + 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 server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.machinelearningservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature """ + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + _attribute_map = { - "value": {"key": "value", "type": "[QuotaBaseProperties]"}, - "location": {"key": "location", "type": "str"}, + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionSharedAccessSignature"}, } def __init__( self, *, - value: Optional[List["_models.QuotaBaseProperties"]] = None, - location: Optional[str] = None, + category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, + target: Optional[str] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionSharedAccessSignature"] = None, **kwargs: Any ) -> None: """ - :keyword value: The list for update quota. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.QuotaBaseProperties] - :keyword location: Region of workspace quota to be updated. - :paramtype location: str + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature """ - super().__init__(**kwargs) - self.value = value - self.location = location + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "SAS" + self.credentials = credentials -class RandomSamplingAlgorithm(SamplingAlgorithm): - """Defines a Sampling Algorithm that generates values randomly. +class SASCredential(DataReferenceCredential): + """Access with full SAS uri. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar sampling_algorithm_type: [Required] The algorithm used for generating hyperparameter - values, along with configuration properties. Required. Known values are: "Grid", "Random", and - "Bayesian". - :vartype sampling_algorithm_type: str or - ~azure.mgmt.machinelearningservices.models.SamplingAlgorithmType - :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. - :vartype seed: int + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "SAS", "DockerCredentials", "ManagedIdentity", and "NoCredentials". + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.DataReferenceCredentialType + :ivar sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :vartype sas_uri: str """ _validation = { - "sampling_algorithm_type": {"required": True}, + "credential_type": {"required": True}, } _attribute_map = { - "sampling_algorithm_type": {"key": "samplingAlgorithmType", "type": "str"}, - "rule": {"key": "rule", "type": "str"}, - "seed": {"key": "seed", "type": "int"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "sas_uri": {"key": "sasUri", "type": "str"}, } - def __init__( - self, - *, - rule: Optional[Union[str, "_models.RandomSamplingAlgorithmRule"]] = None, - seed: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, sas_uri: Optional[str] = None, **kwargs: Any) -> None: """ - :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. - :paramtype seed: int + :keyword sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :paramtype sas_uri: str """ super().__init__(**kwargs) - self.sampling_algorithm_type: str = "Random" - self.rule = rule - self.seed = seed + self.credential_type: str = "SAS" + self.sas_uri = sas_uri -class Recurrence(_serialization.Model): - """The workflow trigger recurrence for ComputeStartStop schedule type. +class SASCredentialDto(PendingUploadCredentialDto): + """SASCredentialDto. - :ivar frequency: [Required] The frequency to trigger schedule. Known values are: "Minute", - "Hour", "Day", "Week", and "Month". - :vartype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency - :ivar interval: [Required] Specifies schedule interval in conjunction with frequency. - :vartype interval: int - :ivar start_time: The start time in yyyy-MM-ddTHH:mm:ss format. - :vartype start_time: str - :ivar time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :vartype time_zone: str - :ivar schedule: [Required] The recurrence schedule. - :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule + All required parameters must be populated in order to send to server. + + :ivar credential_type: [Required] Credential type used to authentication with storage. + Required. "SAS" + :vartype credential_type: str or + ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType + :ivar sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :vartype sas_uri: str """ + _validation = { + "credential_type": {"required": True}, + } + _attribute_map = { - "frequency": {"key": "frequency", "type": "str"}, - "interval": {"key": "interval", "type": "int"}, - "start_time": {"key": "startTime", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "schedule": {"key": "schedule", "type": "RecurrenceSchedule"}, + "credential_type": {"key": "credentialType", "type": "str"}, + "sas_uri": {"key": "sasUri", "type": "str"}, } - def __init__( - self, - *, - frequency: Optional[Union[str, "_models.RecurrenceFrequency"]] = None, - interval: Optional[int] = None, - start_time: Optional[str] = None, - time_zone: str = "UTC", - schedule: Optional["_models.RecurrenceSchedule"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, sas_uri: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword frequency: [Required] The frequency to trigger schedule. Known values are: "Minute", - "Hour", "Day", "Week", and "Month". - :paramtype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency - :keyword interval: [Required] Specifies schedule interval in conjunction with frequency. - :paramtype interval: int - :keyword start_time: The start time in yyyy-MM-ddTHH:mm:ss format. - :paramtype start_time: str - :keyword time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :paramtype time_zone: str - :keyword schedule: [Required] The recurrence schedule. - :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule + :keyword sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. + :paramtype sas_uri: str """ super().__init__(**kwargs) - self.frequency = frequency - self.interval = interval - self.start_time = start_time - self.time_zone = time_zone - self.schedule = schedule + self.credential_type: str = "SAS" + self.sas_uri = sas_uri -class RecurrenceSchedule(_serialization.Model): - """RecurrenceSchedule. +class SasDatastoreCredentials(DatastoreCredentials): + """SAS datastore credentials configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar hours: [Required] List of hours for the schedule. Required. - :vartype hours: list[int] - :ivar minutes: [Required] List of minutes for the schedule. Required. - :vartype minutes: list[int] - :ivar month_days: List of month days for the schedule. - :vartype month_days: list[int] - :ivar week_days: List of days for the schedule. - :vartype week_days: list[str or ~azure.mgmt.machinelearningservices.models.WeekDay] + :ivar credentials_type: [Required] Credential type used to authentication with storage. + Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". + :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType + :ivar secrets: [Required] Storage container secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets """ _validation = { - "hours": {"required": True}, - "minutes": {"required": True}, + "credentials_type": {"required": True}, + "secrets": {"required": True}, } _attribute_map = { - "hours": {"key": "hours", "type": "[int]"}, - "minutes": {"key": "minutes", "type": "[int]"}, - "month_days": {"key": "monthDays", "type": "[int]"}, - "week_days": {"key": "weekDays", "type": "[str]"}, + "credentials_type": {"key": "credentialsType", "type": "str"}, + "secrets": {"key": "secrets", "type": "SasDatastoreSecrets"}, } - def __init__( - self, - *, - hours: List[int], - minutes: List[int], - month_days: Optional[List[int]] = None, - week_days: Optional[List[Union[str, "_models.WeekDay"]]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, secrets: "_models.SasDatastoreSecrets", **kwargs: Any) -> None: """ - :keyword hours: [Required] List of hours for the schedule. Required. - :paramtype hours: list[int] - :keyword minutes: [Required] List of minutes for the schedule. Required. - :paramtype minutes: list[int] - :keyword month_days: List of month days for the schedule. - :paramtype month_days: list[int] - :keyword week_days: List of days for the schedule. - :paramtype week_days: list[str or ~azure.mgmt.machinelearningservices.models.WeekDay] + :keyword secrets: [Required] Storage container secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets """ super().__init__(**kwargs) - self.hours = hours - self.minutes = minutes - self.month_days = month_days - self.week_days = week_days + self.credentials_type: str = "Sas" + self.secrets = secrets -class RecurrenceTrigger(TriggerBase): - """RecurrenceTrigger. +class SasDatastoreSecrets(DatastoreSecrets): + """Datastore SAS secrets. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :vartype end_time: str - :ivar start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :vartype start_time: str - :ivar time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :vartype time_zone: str - :ivar trigger_type: [Required]. Required. Known values are: "Recurrence" and "Cron". - :vartype trigger_type: str or ~azure.mgmt.machinelearningservices.models.TriggerType - :ivar frequency: [Required] The frequency to trigger schedule. Required. Known values are: - "Minute", "Hour", "Day", "Week", and "Month". - :vartype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency - :ivar interval: [Required] Specifies schedule interval in conjunction with frequency. Required. - :vartype interval: int - :ivar schedule: The recurrence schedule. - :vartype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule + :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. + Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". + :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType + :ivar sas_token: Storage container SAS token. + :vartype sas_token: str """ _validation = { - "trigger_type": {"required": True}, - "frequency": {"required": True}, - "interval": {"required": True}, + "secrets_type": {"required": True}, } _attribute_map = { - "end_time": {"key": "endTime", "type": "str"}, - "start_time": {"key": "startTime", "type": "str"}, - "time_zone": {"key": "timeZone", "type": "str"}, - "trigger_type": {"key": "triggerType", "type": "str"}, - "frequency": {"key": "frequency", "type": "str"}, - "interval": {"key": "interval", "type": "int"}, - "schedule": {"key": "schedule", "type": "RecurrenceSchedule"}, + "secrets_type": {"key": "secretsType", "type": "str"}, + "sas_token": {"key": "sasToken", "type": "str"}, + } + + def __init__(self, *, sas_token: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword sas_token: Storage container SAS token. + :paramtype sas_token: str + """ + super().__init__(**kwargs) + self.secrets_type: str = "Sas" + self.sas_token = sas_token + + +class ScaleSettings(_serialization.Model): + """scale settings for AML Compute. + + All required parameters must be populated in order to send to server. + + :ivar max_node_count: Max number of nodes to use. Required. + :vartype max_node_count: int + :ivar min_node_count: Min number of nodes to use. + :vartype min_node_count: int + :ivar node_idle_time_before_scale_down: Node Idle Time before scaling down amlCompute. This + string needs to be in the RFC Format. + :vartype node_idle_time_before_scale_down: ~datetime.timedelta + """ + + _validation = { + "max_node_count": {"required": True}, + } + + _attribute_map = { + "max_node_count": {"key": "maxNodeCount", "type": "int"}, + "min_node_count": {"key": "minNodeCount", "type": "int"}, + "node_idle_time_before_scale_down": {"key": "nodeIdleTimeBeforeScaleDown", "type": "duration"}, } def __init__( self, *, - frequency: Union[str, "_models.RecurrenceFrequency"], - interval: int, - end_time: Optional[str] = None, - start_time: Optional[str] = None, - time_zone: str = "UTC", - schedule: Optional["_models.RecurrenceSchedule"] = None, + max_node_count: int, + min_node_count: int = 0, + node_idle_time_before_scale_down: Optional[datetime.timedelta] = None, **kwargs: Any ) -> None: """ - :keyword end_time: Specifies end time of schedule in ISO 8601, but without a UTC offset. Refer - https://en.wikipedia.org/wiki/ISO_8601. - Recommented format would be "2022-06-01T00:00:01" - If not present, the schedule will run indefinitely. - :paramtype end_time: str - :keyword start_time: Specifies start time of schedule in ISO 8601 format, but without a UTC - offset. - :paramtype start_time: str - :keyword time_zone: Specifies time zone in which the schedule runs. - TimeZone should follow Windows time zone format. Refer: - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones?view=windows-11. - :paramtype time_zone: str - :keyword frequency: [Required] The frequency to trigger schedule. Required. Known values are: - "Minute", "Hour", "Day", "Week", and "Month". - :paramtype frequency: str or ~azure.mgmt.machinelearningservices.models.RecurrenceFrequency - :keyword interval: [Required] Specifies schedule interval in conjunction with frequency. - Required. - :paramtype interval: int - :keyword schedule: The recurrence schedule. - :paramtype schedule: ~azure.mgmt.machinelearningservices.models.RecurrenceSchedule + :keyword max_node_count: Max number of nodes to use. Required. + :paramtype max_node_count: int + :keyword min_node_count: Min number of nodes to use. + :paramtype min_node_count: int + :keyword node_idle_time_before_scale_down: Node Idle Time before scaling down amlCompute. This + string needs to be in the RFC Format. + :paramtype node_idle_time_before_scale_down: ~datetime.timedelta """ - super().__init__(end_time=end_time, start_time=start_time, time_zone=time_zone, **kwargs) - self.trigger_type: str = "Recurrence" - self.frequency = frequency - self.interval = interval - self.schedule = schedule - + super().__init__(**kwargs) + self.max_node_count = max_node_count + self.min_node_count = min_node_count + self.node_idle_time_before_scale_down = node_idle_time_before_scale_down -class RegenerateEndpointKeysRequest(_serialization.Model): - """RegenerateEndpointKeysRequest. - All required parameters must be populated in order to send to Azure. +class ScaleSettingsInformation(_serialization.Model): + """Desired scale settings for the amlCompute. - :ivar key_type: [Required] Specification for which type of key to generate. Primary or - Secondary. Required. Known values are: "Primary" and "Secondary". - :vartype key_type: str or ~azure.mgmt.machinelearningservices.models.KeyType - :ivar key_value: The value the key is set to. - :vartype key_value: str + :ivar scale_settings: scale settings for AML Compute. + :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings """ - _validation = { - "key_type": {"required": True}, + _attribute_map = { + "scale_settings": {"key": "scaleSettings", "type": "ScaleSettings"}, } + def __init__(self, *, scale_settings: Optional["_models.ScaleSettings"] = None, **kwargs: Any) -> None: + """ + :keyword scale_settings: scale settings for AML Compute. + :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + """ + super().__init__(**kwargs) + self.scale_settings = scale_settings + + +class ScaleUnitConfiguration(_serialization.Model): + """Configuration for ScaleUnit pool. + + :ivar disable_public_egress: Gets or sets a value indicating whether PublicEgress is disabled. + :vartype disable_public_egress: bool + :ivar registries: Gets or sets a list of Registry sources that will be used to confirm + identity, storage, ACR. + :vartype registries: list[str] + """ + _attribute_map = { - "key_type": {"key": "keyType", "type": "str"}, - "key_value": {"key": "keyValue", "type": "str"}, + "disable_public_egress": {"key": "disablePublicEgress", "type": "bool"}, + "registries": {"key": "registries", "type": "[str]"}, } def __init__( - self, *, key_type: Union[str, "_models.KeyType"], key_value: Optional[str] = None, **kwargs: Any + self, *, disable_public_egress: bool = False, registries: Optional[List[str]] = None, **kwargs: Any ) -> None: """ - :keyword key_type: [Required] Specification for which type of key to generate. Primary or - Secondary. Required. Known values are: "Primary" and "Secondary". - :paramtype key_type: str or ~azure.mgmt.machinelearningservices.models.KeyType - :keyword key_value: The value the key is set to. - :paramtype key_value: str + :keyword disable_public_egress: Gets or sets a value indicating whether PublicEgress is + disabled. + :paramtype disable_public_egress: bool + :keyword registries: Gets or sets a list of Registry sources that will be used to confirm + identity, storage, ACR. + :paramtype registries: list[str] """ super().__init__(**kwargs) - self.key_type = key_type - self.key_value = key_value + self.disable_public_egress = disable_public_egress + self.registries = registries -class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes - """Registry. +class Schedule(ProxyResource): + """Azure Resource Manager resource envelope. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -17659,36 +28994,8 @@ class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes :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 sku: Sku details required for ARM contract for Autoscaling. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar discovery_url: Discovery URL for the Registry. - :vartype discovery_url: str - :ivar intellectual_property_publisher: IntellectualPropertyPublisher for the registry. - :vartype intellectual_property_publisher: str - :ivar managed_resource_group: ResourceId of the managed RG if the registry has system created - resources. - :vartype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId - :ivar ml_flow_registry_uri: MLFlow Registry URI for the Registry. - :vartype ml_flow_registry_uri: str - :ivar registry_private_endpoint_connections: Private endpoint connections info used for pending - connections in private link portal. - :vartype registry_private_endpoint_connections: - list[~azure.mgmt.machinelearningservices.models.RegistryPrivateEndpointConnection] - :ivar public_network_access: Is the Registry accessible from the internet? - Possible values: "Enabled" or "Disabled". - :vartype public_network_access: str - :ivar region_details: Details of each region the registry is in. - :vartype region_details: - list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] + :ivar properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties """ _validation = { @@ -17696,7 +29003,7 @@ class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "location": {"required": True}, + "properties": {"required": True}, } _attribute_map = { @@ -17704,911 +29011,1149 @@ class Registry(TrackedResource): # pylint: disable=too-many-instance-attributes "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"}, - "sku": {"key": "sku", "type": "Sku"}, - "discovery_url": {"key": "properties.discoveryUrl", "type": "str"}, - "intellectual_property_publisher": {"key": "properties.intellectualPropertyPublisher", "type": "str"}, - "managed_resource_group": {"key": "properties.managedResourceGroup", "type": "ArmResourceId"}, - "ml_flow_registry_uri": {"key": "properties.mlFlowRegistryUri", "type": "str"}, - "registry_private_endpoint_connections": { - "key": "properties.registryPrivateEndpointConnections", - "type": "[RegistryPrivateEndpointConnection]", - }, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "region_details": {"key": "properties.regionDetails", "type": "[RegistryRegionArmDetails]"}, + "properties": {"key": "properties", "type": "ScheduleProperties"}, } - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - kind: Optional[str] = None, - sku: Optional["_models.Sku"] = 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, - registry_private_endpoint_connections: Optional[List["_models.RegistryPrivateEndpointConnection"]] = None, - public_network_access: Optional[str] = None, - region_details: Optional[List["_models.RegistryRegionArmDetails"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: "_models.ScheduleProperties", **kwargs: Any) -> None: """ - :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 sku: Sku details required for ARM contract for Autoscaling. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword discovery_url: Discovery URL for the Registry. - :paramtype discovery_url: str - :keyword intellectual_property_publisher: IntellectualPropertyPublisher for the registry. - :paramtype intellectual_property_publisher: str - :keyword managed_resource_group: ResourceId of the managed RG if the registry has system - created resources. - :paramtype managed_resource_group: ~azure.mgmt.machinelearningservices.models.ArmResourceId - :keyword ml_flow_registry_uri: MLFlow Registry URI for the Registry. - :paramtype ml_flow_registry_uri: str - :keyword registry_private_endpoint_connections: Private endpoint connections info used for - pending connections in private link portal. - :paramtype registry_private_endpoint_connections: - list[~azure.mgmt.machinelearningservices.models.RegistryPrivateEndpointConnection] - :keyword public_network_access: Is the Registry accessible from the internet? - Possible values: "Enabled" or "Disabled". - :paramtype public_network_access: str - :keyword region_details: Details of each region the registry is in. - :paramtype region_details: - list[~azure.mgmt.machinelearningservices.models.RegistryRegionArmDetails] + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties """ - super().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.kind = kind - self.sku = sku - 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.registry_private_endpoint_connections = registry_private_endpoint_connections - self.public_network_access = public_network_access - self.region_details = region_details - + super().__init__(**kwargs) + self.properties = properties -class RegistryListCredentialsResult(_serialization.Model): - """RegistryListCredentialsResult. - Variables are only populated by the server, and will be ignored when sending a request. +class ScheduleBase(_serialization.Model): + """ScheduleBase. - :ivar location: - :vartype location: str - :ivar username: - :vartype username: str - :ivar passwords: - :vartype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :ivar id: A system assigned id for the schedule. + :vartype id: str + :ivar provisioning_status: The current deployment state of schedule. Known values are: + "Completed", "Provisioning", and "Failed". + :vartype provisioning_status: str or + ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningState + :ivar status: Is the schedule enabled or disabled?. Known values are: "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus """ - _validation = { - "location": {"readonly": True}, - "username": {"readonly": True}, - } - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "username": {"key": "username", "type": "str"}, - "passwords": {"key": "passwords", "type": "[Password]"}, + "id": {"key": "id", "type": "str"}, + "provisioning_status": {"key": "provisioningStatus", "type": "str"}, + "status": {"key": "status", "type": "str"}, } - def __init__(self, *, passwords: Optional[List["_models.Password"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + provisioning_status: Optional[Union[str, "_models.ScheduleProvisioningState"]] = None, + status: Optional[Union[str, "_models.ScheduleStatus"]] = None, + **kwargs: Any + ) -> None: """ - :keyword passwords: - :paramtype passwords: list[~azure.mgmt.machinelearningservices.models.Password] + :keyword id: A system assigned id for the schedule. + :paramtype id: str + :keyword provisioning_status: The current deployment state of schedule. Known values are: + "Completed", "Provisioning", and "Failed". + :paramtype provisioning_status: str or + ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningState + :keyword status: Is the schedule enabled or disabled?. Known values are: "Enabled" and + "Disabled". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus """ super().__init__(**kwargs) - self.location = None - self.username = None - self.passwords = passwords + self.id = id + self.provisioning_status = provisioning_status + self.status = status -class RegistryPartialManagedServiceIdentity(ManagedServiceIdentity): - """Managed service identity (system assigned and/or user assigned identities). +class ScheduleProperties(ResourceBase): + """Base definition of a schedule. 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. + All required parameters must be populated in order to send to server. - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :vartype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :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 action: [Required] Specifies the action of the schedule. Required. + :vartype action: ~azure.mgmt.machinelearningservices.models.ScheduleActionBase + :ivar display_name: Display name of schedule. + :vartype display_name: str + :ivar is_enabled: Is the schedule enabled?. + :vartype is_enabled: bool + :ivar provisioning_state: Provisioning state for the schedule. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningStatus + :ivar trigger: [Required] Specifies the trigger details. Required. + :vartype trigger: ~azure.mgmt.machinelearningservices.models.TriggerBase """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "action": {"required": True}, + "provisioning_state": {"readonly": True}, + "trigger": {"required": True}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + "description": {"key": "description", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + "tags": {"key": "tags", "type": "{str}"}, + "action": {"key": "action", "type": "ScheduleActionBase"}, + "display_name": {"key": "displayName", "type": "str"}, + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "trigger": {"key": "trigger", "type": "TriggerBase"}, } def __init__( self, *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + action: "_models.ScheduleActionBase", + trigger: "_models.TriggerBase", + description: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + tags: Optional[Dict[str, str]] = None, + display_name: Optional[str] = None, + is_enabled: bool = True, **kwargs: Any ) -> None: """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned,UserAssigned". - :paramtype type: str or ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.machinelearningservices.models.UserAssignedIdentity] + :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 action: [Required] Specifies the action of the schedule. Required. + :paramtype action: ~azure.mgmt.machinelearningservices.models.ScheduleActionBase + :keyword display_name: Display name of schedule. + :paramtype display_name: str + :keyword is_enabled: Is the schedule enabled?. + :paramtype is_enabled: bool + :keyword trigger: [Required] Specifies the trigger details. Required. + :paramtype trigger: ~azure.mgmt.machinelearningservices.models.TriggerBase """ - super().__init__(type=type, user_assigned_identities=user_assigned_identities, **kwargs) + super().__init__(description=description, properties=properties, tags=tags, **kwargs) + self.action = action + self.display_name = display_name + self.is_enabled = is_enabled + self.provisioning_state = None + self.trigger = trigger -class RegistryPrivateEndpointConnection(_serialization.Model): - """Private endpoint connection definition. +class ScheduleResourceArmPaginatedResult(_serialization.Model): + """A paginated list of Schedule entities. - :ivar id: This is the private endpoint connection name created on SRP - Full resource id: - /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.MachineLearningServices/{resourceType}/{resourceName}/registryPrivateEndpointConnections/{peConnectionName}. - :vartype id: str - :ivar location: Same as workspace location. - :vartype location: str - :ivar group_ids: The group ids. - :vartype group_ids: list[str] - :ivar private_endpoint: The PE network resource that is linked to this PE connection. - :vartype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpointResource - :ivar registry_private_link_service_connection_state: The connection state. - :vartype registry_private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.RegistryPrivateLinkServiceConnectionState - :ivar provisioning_state: One of null, "Succeeded", "Provisioning", "Failed". While not - approved, it's null. - :vartype provisioning_state: str + :ivar next_link: The link to the next page of Schedule objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type Schedule. + :vartype value: list[~azure.mgmt.machinelearningservices.models.Schedule] """ _attribute_map = { - "id": {"key": "id", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "group_ids": {"key": "properties.groupIds", "type": "[str]"}, - "private_endpoint": {"key": "properties.privateEndpoint", "type": "PrivateEndpointResource"}, - "registry_private_link_service_connection_state": { - "key": "properties.registryPrivateLinkServiceConnectionState", - "type": "RegistryPrivateLinkServiceConnectionState", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Schedule]"}, + } + + def __init__( + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Schedule"]] = None, **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of Schedule objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type Schedule. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.Schedule] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ScriptReference(_serialization.Model): + """Script reference. + + :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 + :ivar script_arguments: Optional command line arguments passed to the script to run. + :vartype script_arguments: str + :ivar timeout: Optional time period passed to timeout command. + :vartype timeout: str + """ + + _attribute_map = { + "script_source": {"key": "scriptSource", "type": "str"}, + "script_data": {"key": "scriptData", "type": "str"}, + "script_arguments": {"key": "scriptArguments", "type": "str"}, + "timeout": {"key": "timeout", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - location: Optional[str] = None, - group_ids: Optional[List[str]] = None, - private_endpoint: Optional["_models.PrivateEndpointResource"] = None, - registry_private_link_service_connection_state: Optional[ - "_models.RegistryPrivateLinkServiceConnectionState" - ] = None, - provisioning_state: Optional[str] = None, + script_source: Optional[str] = None, + script_data: Optional[str] = None, + script_arguments: Optional[str] = None, + timeout: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword id: This is the private endpoint connection name created on SRP - Full resource id: - /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.MachineLearningServices/{resourceType}/{resourceName}/registryPrivateEndpointConnections/{peConnectionName}. - :paramtype id: str - :keyword location: Same as workspace location. - :paramtype location: str - :keyword group_ids: The group ids. - :paramtype group_ids: list[str] - :keyword private_endpoint: The PE network resource that is linked to this PE connection. - :paramtype private_endpoint: ~azure.mgmt.machinelearningservices.models.PrivateEndpointResource - :keyword registry_private_link_service_connection_state: The connection state. - :paramtype registry_private_link_service_connection_state: - ~azure.mgmt.machinelearningservices.models.RegistryPrivateLinkServiceConnectionState - :keyword provisioning_state: One of null, "Succeeded", "Provisioning", "Failed". While not - approved, it's null. - :paramtype provisioning_state: str + :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 + :keyword script_arguments: Optional command line arguments passed to the script to run. + :paramtype script_arguments: str + :keyword timeout: Optional time period passed to timeout command. + :paramtype timeout: str """ super().__init__(**kwargs) - self.id = id - self.location = location - self.group_ids = group_ids - self.private_endpoint = private_endpoint - self.registry_private_link_service_connection_state = registry_private_link_service_connection_state - self.provisioning_state = provisioning_state + self.script_source = script_source + self.script_data = script_data + self.script_arguments = script_arguments + self.timeout = timeout -class RegistryPrivateLinkServiceConnectionState(_serialization.Model): - """The connection state. +class ScriptsToExecute(_serialization.Model): + """Customized setup scripts. - :ivar actions_required: Some RP chose "None". Other RPs use this for region expansion. - :vartype actions_required: str - :ivar description: User-defined message that, per NRP doc, may be used for approval-related - message. - :vartype description: str - :ivar status: Connection status of the service consumer with the service provider. Known values - are: "Approved", "Pending", "Rejected", and "Disconnected". - :vartype status: str or - ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus + :ivar startup_script: Script that's run every time the machine starts. + :vartype startup_script: ~azure.mgmt.machinelearningservices.models.ScriptReference + :ivar creation_script: Script that's run only once during provision of the compute. + :vartype creation_script: ~azure.mgmt.machinelearningservices.models.ScriptReference """ _attribute_map = { - "actions_required": {"key": "actionsRequired", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "startup_script": {"key": "startupScript", "type": "ScriptReference"}, + "creation_script": {"key": "creationScript", "type": "ScriptReference"}, } def __init__( self, *, - actions_required: Optional[str] = None, - description: Optional[str] = None, - status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = None, + startup_script: Optional["_models.ScriptReference"] = None, + creation_script: Optional["_models.ScriptReference"] = None, **kwargs: Any ) -> None: """ - :keyword actions_required: Some RP chose "None". Other RPs use this for region expansion. - :paramtype actions_required: str - :keyword description: User-defined message that, per NRP doc, may be used for approval-related - message. - :paramtype description: str - :keyword status: Connection status of the service consumer with the service provider. Known - values are: "Approved", "Pending", "Rejected", and "Disconnected". - :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus - """ - super().__init__(**kwargs) - self.actions_required = actions_required - self.description = description - self.status = status + :keyword startup_script: Script that's run every time the machine starts. + :paramtype startup_script: ~azure.mgmt.machinelearningservices.models.ScriptReference + :keyword creation_script: Script that's run only once during provision of the compute. + :paramtype creation_script: ~azure.mgmt.machinelearningservices.models.ScriptReference + """ + super().__init__(**kwargs) + self.startup_script = startup_script + self.creation_script = creation_script -class RegistryRegionArmDetails(_serialization.Model): - """Details for each region the registry is in. +class SecretExpiry(_serialization.Model): + """Secret expiration configuration. - :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] + :ivar expirable_secret: Indicates if the secret is expirable. + :vartype expirable_secret: bool + :ivar expire_after_hours: Number of hours after which the secret will expire. + :vartype expire_after_hours: int """ _attribute_map = { - "acr_details": {"key": "acrDetails", "type": "[AcrDetails]"}, - "location": {"key": "location", "type": "str"}, - "storage_account_details": {"key": "storageAccountDetails", "type": "[StorageAccountDetails]"}, + "expirable_secret": {"key": "expirableSecret", "type": "bool"}, + "expire_after_hours": {"key": "expireAfterHours", "type": "int"}, } - def __init__( - self, - *, - acr_details: Optional[List["_models.AcrDetails"]] = None, - location: Optional[str] = None, - storage_account_details: Optional[List["_models.StorageAccountDetails"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, expirable_secret: bool = False, expire_after_hours: int = 1, **kwargs: Any) -> None: """ - :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] + :keyword expirable_secret: Indicates if the secret is expirable. + :paramtype expirable_secret: bool + :keyword expire_after_hours: Number of hours after which the secret will expire. + :paramtype expire_after_hours: int """ super().__init__(**kwargs) - self.acr_details = acr_details - self.location = location - self.storage_account_details = storage_account_details + self.expirable_secret = expirable_secret + self.expire_after_hours = expire_after_hours -class RegistryTrackedResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Registry entities. +class ServerlessComputeSettings(_serialization.Model): + """ServerlessComputeSettings. - :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] + :ivar serverless_compute_custom_subnet: The resource ID of an existing virtual network subnet + in which serverless compute nodes should be deployed. + :vartype serverless_compute_custom_subnet: str + :ivar serverless_compute_no_public_ip: The flag to signal if serverless compute nodes deployed + in custom vNet would have no public IP addresses for a workspace with private endpoint. + :vartype serverless_compute_no_public_ip: bool """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Registry]"}, + "serverless_compute_custom_subnet": {"key": "serverlessComputeCustomSubnet", "type": "str"}, + "serverless_compute_no_public_ip": {"key": "serverlessComputeNoPublicIP", "type": "bool"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.Registry"]] = None, **kwargs: Any + self, + *, + serverless_compute_custom_subnet: Optional[str] = None, + serverless_compute_no_public_ip: Optional[bool] = None, + **kwargs: Any ) -> None: """ - :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] + :keyword serverless_compute_custom_subnet: The resource ID of an existing virtual network + subnet in which serverless compute nodes should be deployed. + :paramtype serverless_compute_custom_subnet: str + :keyword serverless_compute_no_public_ip: The flag to signal if serverless compute nodes + deployed in custom vNet would have no public IP addresses for a workspace with private + endpoint. + :paramtype serverless_compute_no_public_ip: bool """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.serverless_compute_custom_subnet = serverless_compute_custom_subnet + self.serverless_compute_no_public_ip = serverless_compute_no_public_ip -class Regression(TableVertical, AutoMLVertical): # pylint: disable=too-many-instance-attributes - """Regression task in AutoML Table vertical. +class ServerlessEndpoint(TrackedResource): + """ServerlessEndpoint. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :vartype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :ivar target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :vartype target_column_name: str - :ivar task_type: [Required] Task type for AutoMLJob. Required. Known values are: - "Classification", "Regression", "Forecasting", "ImageClassification", - "ImageClassificationMultilabel", "ImageObjectDetection", "ImageInstanceSegmentation", - "TextClassification", "TextClassificationMultilabel", and "TextNER". - :vartype task_type: str or ~azure.mgmt.machinelearningservices.models.TaskType - :ivar training_data: [Required] Training data input. Required. - :vartype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar cv_split_column_names: Columns to use for CVSplit data. - :vartype cv_split_column_names: list[str] - :ivar featurization_settings: Featurization inputs needed for AutoML job. - :vartype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :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 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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype test_data_size: float - :ivar validation_data: Validation data inputs. - :vartype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :ivar validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :vartype validation_data_size: float - :ivar weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :vartype weight_column_name: str - :ivar primary_metric: Primary metric for regression task. Known values are: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and - "NormalizedMeanAbsoluteError". - :vartype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.RegressionPrimaryMetrics - :ivar training_settings: Inputs for training phase for an AutoML Job. - :vartype training_settings: - ~azure.mgmt.machinelearningservices.models.RegressionTrainingSettings + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :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.ServerlessEndpointProperties + :ivar sku: Sku details required for ARM contract for Autoscaling. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku """ _validation = { - "task_type": {"required": True}, - "training_data": {"required": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "location": {"required": True}, + "properties": {"required": True}, } _attribute_map = { - "log_verbosity": {"key": "logVerbosity", "type": "str"}, - "target_column_name": {"key": "targetColumnName", "type": "str"}, - "task_type": {"key": "taskType", "type": "str"}, - "training_data": {"key": "trainingData", "type": "MLTableJobInput"}, - "cv_split_column_names": {"key": "cvSplitColumnNames", "type": "[str]"}, - "featurization_settings": {"key": "featurizationSettings", "type": "TableVerticalFeaturizationSettings"}, - "limit_settings": {"key": "limitSettings", "type": "TableVerticalLimitSettings"}, - "n_cross_validations": {"key": "nCrossValidations", "type": "NCrossValidations"}, - "test_data": {"key": "testData", "type": "MLTableJobInput"}, - "test_data_size": {"key": "testDataSize", "type": "float"}, - "validation_data": {"key": "validationData", "type": "MLTableJobInput"}, - "validation_data_size": {"key": "validationDataSize", "type": "float"}, - "weight_column_name": {"key": "weightColumnName", "type": "str"}, - "primary_metric": {"key": "primaryMetric", "type": "str"}, - "training_settings": {"key": "trainingSettings", "type": "RegressionTrainingSettings"}, + "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": "ServerlessEndpointProperties"}, + "sku": {"key": "sku", "type": "Sku"}, } def __init__( self, *, - training_data: "_models.MLTableJobInput", - log_verbosity: Optional[Union[str, "_models.LogVerbosity"]] = None, - target_column_name: Optional[str] = None, - cv_split_column_names: Optional[List[str]] = None, - featurization_settings: Optional["_models.TableVerticalFeaturizationSettings"] = None, - limit_settings: Optional["_models.TableVerticalLimitSettings"] = None, - n_cross_validations: Optional["_models.NCrossValidations"] = None, - test_data: Optional["_models.MLTableJobInput"] = None, - test_data_size: Optional[float] = None, - validation_data: Optional["_models.MLTableJobInput"] = None, - validation_data_size: Optional[float] = None, - weight_column_name: Optional[str] = None, - primary_metric: Optional[Union[str, "_models.RegressionPrimaryMetrics"]] = None, - training_settings: Optional["_models.RegressionTrainingSettings"] = None, - **kwargs: Any - ) -> None: - """ - :keyword log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", - "Warning", "Error", and "Critical". - :paramtype log_verbosity: str or ~azure.mgmt.machinelearningservices.models.LogVerbosity - :keyword target_column_name: Target column name: This is prediction values column. - Also known as label column name in context of classification tasks. - :paramtype target_column_name: str - :keyword training_data: [Required] Training data input. Required. - :paramtype training_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword cv_split_column_names: Columns to use for CVSplit data. - :paramtype cv_split_column_names: list[str] - :keyword featurization_settings: Featurization inputs needed for AutoML job. - :paramtype featurization_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalFeaturizationSettings - :keyword limit_settings: Execution constraints for AutoMLJob. - :paramtype limit_settings: - ~azure.mgmt.machinelearningservices.models.TableVerticalLimitSettings - :keyword n_cross_validations: Number of cross validation folds to be applied on training - dataset - when validation dataset is not provided. - :paramtype n_cross_validations: ~azure.mgmt.machinelearningservices.models.NCrossValidations - :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 - purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype test_data_size: float - :keyword validation_data: Validation data inputs. - :paramtype validation_data: ~azure.mgmt.machinelearningservices.models.MLTableJobInput - :keyword validation_data_size: The fraction of training dataset that needs to be set aside for - validation purpose. - Values between (0.0 , 1.0) - Applied when validation dataset is not provided. - :paramtype validation_data_size: float - :keyword weight_column_name: The name of the sample weight column. Automated ML supports a - weighted column as an input, causing rows in the data to be weighted up or down. - :paramtype weight_column_name: str - :keyword primary_metric: Primary metric for regression task. Known values are: - "SpearmanCorrelation", "NormalizedRootMeanSquaredError", "R2Score", and - "NormalizedMeanAbsoluteError". - :paramtype primary_metric: str or - ~azure.mgmt.machinelearningservices.models.RegressionPrimaryMetrics - :keyword training_settings: Inputs for training phase for an AutoML Job. - :paramtype training_settings: - ~azure.mgmt.machinelearningservices.models.RegressionTrainingSettings - """ - super().__init__( - cv_split_column_names=cv_split_column_names, - featurization_settings=featurization_settings, - limit_settings=limit_settings, - n_cross_validations=n_cross_validations, - test_data=test_data, - test_data_size=test_data_size, - validation_data=validation_data, - validation_data_size=validation_data_size, - weight_column_name=weight_column_name, - log_verbosity=log_verbosity, - target_column_name=target_column_name, - training_data=training_data, - **kwargs - ) - self.log_verbosity = log_verbosity - self.target_column_name = target_column_name - self.task_type: str = "Regression" - self.training_data = training_data - self.primary_metric = primary_metric - self.training_settings = training_settings - self.cv_split_column_names = cv_split_column_names - self.featurization_settings = featurization_settings - self.limit_settings = limit_settings - self.n_cross_validations = n_cross_validations - self.test_data = test_data - self.test_data_size = test_data_size - self.validation_data = validation_data - self.validation_data_size = validation_data_size - self.weight_column_name = weight_column_name + location: str, + properties: "_models.ServerlessEndpointProperties", + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + **kwargs: Any + ) -> None: + """ + :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.ServerlessEndpointProperties + :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 RegressionTrainingSettings(TrainingSettings): - """Regression Training related configuration. +class ServerlessEndpointCapacityReservation(_serialization.Model): + """ServerlessEndpointCapacityReservation. - :ivar enable_dnn_training: Enable recommendation of DNN models. - :vartype enable_dnn_training: bool - :ivar enable_model_explainability: Flag to turn on explainability on best model. - :vartype enable_model_explainability: bool - :ivar enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :vartype enable_onnx_compatible_models: bool - :ivar enable_stack_ensemble: Enable stack ensemble run. - :vartype enable_stack_ensemble: bool - :ivar enable_vote_ensemble: Enable voting ensemble run. - :vartype enable_vote_ensemble: bool - :ivar ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :vartype ensemble_model_download_timeout: ~datetime.timedelta - :ivar stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :vartype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :ivar allowed_training_algorithms: Allowed models for regression task. - :vartype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.RegressionModels] - :ivar blocked_training_algorithms: Blocked models for regression task. - :vartype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.RegressionModels] + All required parameters must be populated in order to send to server. + + :ivar capacity_reservation_group_id: Required. + :vartype capacity_reservation_group_id: str + :ivar endpoint_reserved_capacity: + :vartype endpoint_reserved_capacity: int """ + _validation = { + "capacity_reservation_group_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _attribute_map = { - "enable_dnn_training": {"key": "enableDnnTraining", "type": "bool"}, - "enable_model_explainability": {"key": "enableModelExplainability", "type": "bool"}, - "enable_onnx_compatible_models": {"key": "enableOnnxCompatibleModels", "type": "bool"}, - "enable_stack_ensemble": {"key": "enableStackEnsemble", "type": "bool"}, - "enable_vote_ensemble": {"key": "enableVoteEnsemble", "type": "bool"}, - "ensemble_model_download_timeout": {"key": "ensembleModelDownloadTimeout", "type": "duration"}, - "stack_ensemble_settings": {"key": "stackEnsembleSettings", "type": "StackEnsembleSettings"}, - "allowed_training_algorithms": {"key": "allowedTrainingAlgorithms", "type": "[str]"}, - "blocked_training_algorithms": {"key": "blockedTrainingAlgorithms", "type": "[str]"}, + "capacity_reservation_group_id": {"key": "capacityReservationGroupId", "type": "str"}, + "endpoint_reserved_capacity": {"key": "endpointReservedCapacity", "type": "int"}, } def __init__( - self, - *, - enable_dnn_training: bool = False, - enable_model_explainability: bool = True, - enable_onnx_compatible_models: bool = False, - enable_stack_ensemble: bool = True, - enable_vote_ensemble: bool = True, - ensemble_model_download_timeout: datetime.timedelta = "PT5M", - stack_ensemble_settings: Optional["_models.StackEnsembleSettings"] = None, - allowed_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, - blocked_training_algorithms: Optional[List[Union[str, "_models.RegressionModels"]]] = None, - **kwargs: Any + self, *, capacity_reservation_group_id: str, endpoint_reserved_capacity: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword enable_dnn_training: Enable recommendation of DNN models. - :paramtype enable_dnn_training: bool - :keyword enable_model_explainability: Flag to turn on explainability on best model. - :paramtype enable_model_explainability: bool - :keyword enable_onnx_compatible_models: Flag for enabling onnx compatible models. - :paramtype enable_onnx_compatible_models: bool - :keyword enable_stack_ensemble: Enable stack ensemble run. - :paramtype enable_stack_ensemble: bool - :keyword enable_vote_ensemble: Enable voting ensemble run. - :paramtype enable_vote_ensemble: bool - :keyword ensemble_model_download_timeout: During VotingEnsemble and StackEnsemble model - generation, multiple fitted models from the previous child runs are downloaded. - Configure this parameter with a higher value than 300 secs, if more time is needed. - :paramtype ensemble_model_download_timeout: ~datetime.timedelta - :keyword stack_ensemble_settings: Stack ensemble settings for stack ensemble run. - :paramtype stack_ensemble_settings: - ~azure.mgmt.machinelearningservices.models.StackEnsembleSettings - :keyword allowed_training_algorithms: Allowed models for regression task. - :paramtype allowed_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.RegressionModels] - :keyword blocked_training_algorithms: Blocked models for regression task. - :paramtype blocked_training_algorithms: list[str or - ~azure.mgmt.machinelearningservices.models.RegressionModels] + :keyword capacity_reservation_group_id: Required. + :paramtype capacity_reservation_group_id: str + :keyword endpoint_reserved_capacity: + :paramtype endpoint_reserved_capacity: int """ - super().__init__( - enable_dnn_training=enable_dnn_training, - enable_model_explainability=enable_model_explainability, - enable_onnx_compatible_models=enable_onnx_compatible_models, - enable_stack_ensemble=enable_stack_ensemble, - enable_vote_ensemble=enable_vote_ensemble, - ensemble_model_download_timeout=ensemble_model_download_timeout, - stack_ensemble_settings=stack_ensemble_settings, - **kwargs - ) - self.allowed_training_algorithms = allowed_training_algorithms - self.blocked_training_algorithms = blocked_training_algorithms + super().__init__(**kwargs) + self.capacity_reservation_group_id = capacity_reservation_group_id + self.endpoint_reserved_capacity = endpoint_reserved_capacity -class ResourceId(_serialization.Model): - """Represents a resource ID. For example, for a subnet, it is the resource URL for the subnet. +class ServerlessEndpointContentSafety(_serialization.Model): + """ServerlessEndpointContentSafety. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar id: The ID of the resource. Required. - :vartype id: str + :ivar content_safety_status: Specifies the status of content safety. Required. Known values + are: "Enabled" and "Disabled". + :vartype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus """ _validation = { - "id": {"required": True}, + "content_safety_status": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, + "content_safety_status": {"key": "contentSafetyStatus", "type": "str"}, } - def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + def __init__(self, *, content_safety_status: Union[str, "_models.ContentSafetyStatus"], **kwargs: Any) -> None: """ - :keyword id: The ID of the resource. Required. - :paramtype id: str + :keyword content_safety_status: Specifies the status of content safety. Required. Known values + are: "Enabled" and "Disabled". + :paramtype content_safety_status: str or + ~azure.mgmt.machinelearningservices.models.ContentSafetyStatus """ super().__init__(**kwargs) - self.id = id + self.content_safety_status = content_safety_status -class ResourceName(_serialization.Model): - """The Resource Name. +class ServerlessEndpointInferenceEndpoint(_serialization.Model): + """ServerlessEndpointInferenceEndpoint. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The name of the resource. - :vartype value: str - :ivar localized_value: The localized name of the resource. - :vartype localized_value: str + All required parameters must be populated in order to send to server. + + :ivar headers: Dictionary of :code:``. + :vartype headers: dict[str, str] + :ivar uri: Required. + :vartype uri: str """ _validation = { - "value": {"readonly": True}, - "localized_value": {"readonly": True}, + "headers": {"readonly": True}, + "uri": {"required": True}, } _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, + "headers": {"key": "headers", "type": "{str}"}, + "uri": {"key": "uri", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, uri: str, **kwargs: Any) -> None: + """ + :keyword uri: Required. + :paramtype uri: str + """ super().__init__(**kwargs) - self.value = None - self.localized_value = None + self.headers = None + self.uri = uri -class ResourceQuota(_serialization.Model): - """The quota assigned to a resource. +class ServerlessEndpointModelSettings(_serialization.Model): + """ServerlessEndpointModelSettings. + + All required parameters must be populated in order to send to server. + + :ivar model_id: Required. + :vartype model_id: str + """ + + _validation = { + "model_id": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + + _attribute_map = { + "model_id": {"key": "modelId", "type": "str"}, + } + + def __init__(self, *, model_id: str, **kwargs: Any) -> None: + """ + :keyword model_id: Required. + :paramtype model_id: str + """ + super().__init__(**kwargs) + self.model_id = model_id + + +class ServerlessEndpointProperties(_serialization.Model): + """ServerlessEndpointProperties. + + 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 server. + + :ivar auth_mode: [Required] Specifies the authentication mode for the Serverless endpoint. + Required. "Key" + :vartype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :ivar content_safety: Specifies the content safety options. If omitted, the default content + safety settings will be configured. + :vartype content_safety: ~azure.mgmt.machinelearningservices.models.ContentSafety + :ivar endpoint_state: The current state of the ServerlessEndpoint. Known values are: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + and "DeletionFailed". + :vartype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :ivar inference_endpoint: The inference uri to target when making requests against the + serverless endpoint. + :vartype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpoint + :ivar marketplace_subscription_id: The MarketplaceSubscription Azure ID associated to this + ServerlessEndpoint. + :vartype marketplace_subscription_id: str + :ivar model_settings: The model settings (model id) for the model being serviced on the + ServerlessEndpoint. + :vartype model_settings: ~azure.mgmt.machinelearningservices.models.ModelSettings + :ivar provisioning_state: Provisioning state for the endpoint. Known values are: "Creating", + "Deleting", "Succeeded", "Failed", "Updating", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.EndpointProvisioningState + """ + + _validation = { + "auth_mode": {"required": True}, + "endpoint_state": {"readonly": True}, + "inference_endpoint": {"readonly": True}, + "marketplace_subscription_id": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "auth_mode": {"key": "authMode", "type": "str"}, + "content_safety": {"key": "contentSafety", "type": "ContentSafety"}, + "endpoint_state": {"key": "endpointState", "type": "str"}, + "inference_endpoint": {"key": "inferenceEndpoint", "type": "ServerlessInferenceEndpoint"}, + "marketplace_subscription_id": {"key": "marketplaceSubscriptionId", "type": "str"}, + "model_settings": {"key": "modelSettings", "type": "ModelSettings"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + auth_mode: Union[str, "_models.ServerlessInferenceEndpointAuthMode"], + content_safety: Optional["_models.ContentSafety"] = None, + model_settings: Optional["_models.ModelSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword auth_mode: [Required] Specifies the authentication mode for the Serverless endpoint. + Required. "Key" + :paramtype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :keyword content_safety: Specifies the content safety options. If omitted, the default content + safety settings will be configured. + :paramtype content_safety: ~azure.mgmt.machinelearningservices.models.ContentSafety + :keyword model_settings: The model settings (model id) for the model being serviced on the + ServerlessEndpoint. + :paramtype model_settings: ~azure.mgmt.machinelearningservices.models.ModelSettings + """ + super().__init__(**kwargs) + self.auth_mode = auth_mode + self.content_safety = content_safety + self.endpoint_state = None + self.inference_endpoint = None + self.marketplace_subscription_id = None + self.model_settings = model_settings + self.provisioning_state = None + + +class ServerlessEndpointResourceProperties(EndpointResourceProperties): # pylint: disable=too-many-instance-attributes + """ServerlessEndpointResourceProperties. + + 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 server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. + :vartype name: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool + :ivar auth_mode: "Key" + :vartype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :ivar capacity_reservation: + :vartype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :ivar content_safety: + :vartype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :ivar endpoint_state: State of the Serverless Endpoint. Known values are: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + and "DeletionFailed". + :vartype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :ivar inference_endpoint: + :vartype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :ivar marketplace_subscription_id: + :vartype marketplace_subscription_id: str + :ivar metadata: Anything. + :vartype metadata: any + :ivar model_settings: + :vartype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :ivar offer: + :vartype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + + _validation = { + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, + "auth_mode": {"key": "authMode", "type": "str"}, + "capacity_reservation": {"key": "capacityReservation", "type": "ServerlessEndpointCapacityReservation"}, + "content_safety": {"key": "contentSafety", "type": "ServerlessEndpointContentSafety"}, + "endpoint_state": {"key": "endpointState", "type": "str"}, + "inference_endpoint": {"key": "inferenceEndpoint", "type": "ServerlessEndpointInferenceEndpoint"}, + "marketplace_subscription_id": {"key": "marketplaceSubscriptionId", "type": "str"}, + "metadata": {"key": "metadata", "type": "object"}, + "model_settings": {"key": "modelSettings", "type": "ServerlessEndpointModelSettings"}, + "offer": {"key": "offer", "type": "ServerlessOffer"}, + } + + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + auth_mode: Optional[Union[str, "_models.ServerlessInferenceEndpointAuthMode"]] = None, + capacity_reservation: Optional["_models.ServerlessEndpointCapacityReservation"] = None, + content_safety: Optional["_models.ServerlessEndpointContentSafety"] = None, + endpoint_state: Optional[Union[str, "_models.ServerlessEndpointState"]] = None, + inference_endpoint: Optional["_models.ServerlessEndpointInferenceEndpoint"] = None, + marketplace_subscription_id: Optional[str] = None, + metadata: Optional[Any] = None, + model_settings: Optional["_models.ServerlessEndpointModelSettings"] = None, + offer: Optional["_models.ServerlessOffer"] = None, + **kwargs: Any + ) -> None: + """ + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. + :paramtype name: str + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool + :keyword auth_mode: "Key" + :paramtype auth_mode: str or + ~azure.mgmt.machinelearningservices.models.ServerlessInferenceEndpointAuthMode + :keyword capacity_reservation: + :paramtype capacity_reservation: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointCapacityReservation + :keyword content_safety: + :paramtype content_safety: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointContentSafety + :keyword endpoint_state: State of the Serverless Endpoint. Known values are: "Unknown", + "Creating", "Deleting", "Suspending", "Reinstating", "Online", "Suspended", "CreationFailed", + and "DeletionFailed". + :paramtype endpoint_state: str or + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointState + :keyword inference_endpoint: + :paramtype inference_endpoint: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointInferenceEndpoint + :keyword marketplace_subscription_id: + :paramtype marketplace_subscription_id: str + :keyword metadata: Anything. + :paramtype metadata: any + :keyword model_settings: + :paramtype model_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessEndpointModelSettings + :keyword offer: + :paramtype offer: ~azure.mgmt.machinelearningservices.models.ServerlessOffer + """ + super().__init__( + associated_resource_id=associated_resource_id, + deployments=deployments, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + location=location, + name=name, + should_create_ai_services_endpoint=should_create_ai_services_endpoint, + **kwargs + ) + self.endpoint_type: str = "serverlessEndpoint" + self.auth_mode = auth_mode + self.capacity_reservation = capacity_reservation + self.content_safety = content_safety + self.endpoint_state = endpoint_state + self.inference_endpoint = inference_endpoint + self.marketplace_subscription_id = marketplace_subscription_id + self.metadata = metadata + self.model_settings = model_settings + self.offer = offer + + +class ServerlessEndpointTrackedResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """A paginated list of ServerlessEndpoint entities. + + :ivar next_link: The link to the next page of ServerlessEndpoint objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type ServerlessEndpoint. + :vartype value: list[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ServerlessEndpoint]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ServerlessEndpoint"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: The link to the next page of ServerlessEndpoint objects. If null, there are + no additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type ServerlessEndpoint. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ServerlessInferenceEndpoint(_serialization.Model): + """ServerlessInferenceEndpoint. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Specifies the resource ID. - :vartype id: str - :ivar aml_workspace_location: Region of the AML workspace in the id. - :vartype aml_workspace_location: str - :ivar type: Specifies the resource type. - :vartype type: str - :ivar name: Name of the resource. - :vartype name: ~azure.mgmt.machinelearningservices.models.ResourceName - :ivar limit: The maximum permitted quota of the resource. - :vartype limit: int - :ivar unit: An enum describing the unit of quota measurement. "Count" - :vartype unit: str or ~azure.mgmt.machinelearningservices.models.QuotaUnit + All required parameters must be populated in order to send to server. + + :ivar headers: Specifies any required headers to target this serverless endpoint. + :vartype headers: dict[str, str] + :ivar uri: [Required] The inference uri to target when making requests against the Serverless + Endpoint. Required. + :vartype uri: str """ _validation = { - "id": {"readonly": True}, - "aml_workspace_location": {"readonly": True}, - "type": {"readonly": True}, - "name": {"readonly": True}, - "limit": {"readonly": True}, - "unit": {"readonly": True}, + "headers": {"readonly": True}, + "uri": {"required": True}, } _attribute_map = { - "id": {"key": "id", "type": "str"}, - "aml_workspace_location": {"key": "amlWorkspaceLocation", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "ResourceName"}, - "limit": {"key": "limit", "type": "int"}, - "unit": {"key": "unit", "type": "str"}, + "headers": {"key": "headers", "type": "{str}"}, + "uri": {"key": "uri", "type": "str"}, } - def __init__(self, **kwargs: Any) -> None: - """ """ + def __init__(self, *, uri: str, **kwargs: Any) -> None: + """ + :keyword uri: [Required] The inference uri to target when making requests against the + Serverless Endpoint. Required. + :paramtype uri: str + """ super().__init__(**kwargs) - self.id = None - self.aml_workspace_location = None - self.type = None - self.name = None - self.limit = None - self.unit = None + self.headers = None + self.uri = uri -class Route(_serialization.Model): - """Route. +class ServerlessOffer(_serialization.Model): + """ServerlessOffer. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar path: [Required] The path for the route. Required. - :vartype path: str - :ivar port: [Required] The port for the route. Required. - :vartype port: int + :ivar offer_name: Required. + :vartype offer_name: str + :ivar publisher: Required. + :vartype publisher: str """ _validation = { - "path": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, - "port": {"required": True}, + "offer_name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "publisher": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "path": {"key": "path", "type": "str"}, - "port": {"key": "port", "type": "int"}, + "offer_name": {"key": "offerName", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, } - def __init__(self, *, path: str, port: int, **kwargs: Any) -> None: + def __init__(self, *, offer_name: str, publisher: str, **kwargs: Any) -> None: """ - :keyword path: [Required] The path for the route. Required. - :paramtype path: str - :keyword port: [Required] The port for the route. Required. - :paramtype port: int + :keyword offer_name: Required. + :paramtype offer_name: str + :keyword publisher: Required. + :paramtype publisher: str """ super().__init__(**kwargs) - self.path = path - self.port = port + self.offer_name = offer_name + self.publisher = publisher -class SASAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): - """SASAuthTypeWorkspaceConnectionProperties. +class ServiceManagedResourcesSettings(_serialization.Model): + """ServiceManagedResourcesSettings. + + :ivar cosmos_db: + :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + """ + + _attribute_map = { + "cosmos_db": {"key": "cosmosDb", "type": "CosmosDbSettings"}, + } + + def __init__(self, *, cosmos_db: Optional["_models.CosmosDbSettings"] = None, **kwargs: Any) -> None: + """ + :keyword cosmos_db: + :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + """ + super().__init__(**kwargs) + self.cosmos_db = cosmos_db + + +class ServicePrincipalAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long + """ServicePrincipalAuthTypeWorkspaceConnectionProperties. + + 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. + All required parameters must be populated in order to send to server. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". :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", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] :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 use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal """ _validation = { "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, } _attribute_map = { "auth_type": {"key": "authType", "type": "str"}, "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, "target": {"key": "target", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "value_format": {"key": "valueFormat", "type": "str"}, - "credentials": {"key": "credentials", "type": "WorkspaceConnectionSharedAccessSignature"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "WorkspaceConnectionServicePrincipal"}, } def __init__( self, *, category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, target: Optional[str] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "_models.ValueFormat"]] = None, - credentials: Optional["_models.WorkspaceConnectionSharedAccessSignature"] = None, + use_workspace_managed_identity: Optional[bool] = None, + credentials: Optional["_models.WorkspaceConnectionServicePrincipal"] = None, **kwargs: Any ) -> None: """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] :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 use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionSharedAccessSignature + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionServicePrincipal """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) - self.auth_type: str = "SAS" + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ServicePrincipal" self.credentials = credentials -class SASCredentialDto(PendingUploadCredentialDto): - """SASCredentialDto. - - All required parameters must be populated in order to send to Azure. - - :ivar credential_type: [Required] Credential type used to authentication with storage. - Required. "SAS" - :vartype credential_type: str or - ~azure.mgmt.machinelearningservices.models.PendingUploadCredentialType - :ivar sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. - :vartype sas_uri: str - """ - - _validation = { - "credential_type": {"required": True}, - } - - _attribute_map = { - "credential_type": {"key": "credentialType", "type": "str"}, - "sas_uri": {"key": "sasUri", "type": "str"}, - } - - def __init__(self, *, sas_uri: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword sas_uri: Full SAS Uri, including the storage, container/blob path and SAS token. - :paramtype sas_uri: str - """ - super().__init__(**kwargs) - self.credential_type: str = "SAS" - self.sas_uri = sas_uri - - -class SasDatastoreCredentials(DatastoreCredentials): - """SAS datastore credentials configuration. +class ServicePrincipalDatastoreCredentials(DatastoreCredentials): + """Service Principal datastore credentials configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar credentials_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType - :ivar secrets: [Required] Storage container secrets. Required. - :vartype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets + :ivar authority_url: Authority URL used for authentication. + :vartype authority_url: str + :ivar client_id: [Required] Service principal client ID. Required. + :vartype client_id: str + :ivar resource_url: Resource the service principal has access to. + :vartype resource_url: str + :ivar secrets: [Required] Service principal secrets. Required. + :vartype secrets: ~azure.mgmt.machinelearningservices.models.ServicePrincipalDatastoreSecrets + :ivar tenant_id: [Required] ID of the tenant to which the service principal belongs. Required. + :vartype tenant_id: str """ _validation = { "credentials_type": {"required": True}, + "client_id": {"required": True}, "secrets": {"required": True}, + "tenant_id": {"required": True}, } _attribute_map = { "credentials_type": {"key": "credentialsType", "type": "str"}, - "secrets": {"key": "secrets", "type": "SasDatastoreSecrets"}, + "authority_url": {"key": "authorityUrl", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "resource_url": {"key": "resourceUrl", "type": "str"}, + "secrets": {"key": "secrets", "type": "ServicePrincipalDatastoreSecrets"}, + "tenant_id": {"key": "tenantId", "type": "str"}, } - def __init__(self, *, secrets: "_models.SasDatastoreSecrets", **kwargs: Any) -> None: + def __init__( + self, + *, + client_id: str, + secrets: "_models.ServicePrincipalDatastoreSecrets", + tenant_id: str, + authority_url: Optional[str] = None, + resource_url: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword secrets: [Required] Storage container secrets. Required. - :paramtype secrets: ~azure.mgmt.machinelearningservices.models.SasDatastoreSecrets + :keyword authority_url: Authority URL used for authentication. + :paramtype authority_url: str + :keyword client_id: [Required] Service principal client ID. Required. + :paramtype client_id: str + :keyword resource_url: Resource the service principal has access to. + :paramtype resource_url: str + :keyword secrets: [Required] Service principal secrets. Required. + :paramtype secrets: ~azure.mgmt.machinelearningservices.models.ServicePrincipalDatastoreSecrets + :keyword tenant_id: [Required] ID of the tenant to which the service principal belongs. + Required. + :paramtype tenant_id: str """ super().__init__(**kwargs) - self.credentials_type: str = "Sas" + self.credentials_type: str = "ServicePrincipal" + self.authority_url = authority_url + self.client_id = client_id + self.resource_url = resource_url self.secrets = secrets + self.tenant_id = tenant_id -class SasDatastoreSecrets(DatastoreSecrets): - """Datastore SAS secrets. +class ServicePrincipalDatastoreSecrets(DatastoreSecrets): + """Datastore Service Principal secrets. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType - :ivar sas_token: Storage container SAS token. - :vartype sas_token: str + :ivar client_secret: Service principal secret. + :vartype client_secret: str """ _validation = { @@ -18617,788 +30162,977 @@ class SasDatastoreSecrets(DatastoreSecrets): _attribute_map = { "secrets_type": {"key": "secretsType", "type": "str"}, - "sas_token": {"key": "sasToken", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, } - def __init__(self, *, sas_token: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword sas_token: Storage container SAS token. - :paramtype sas_token: str + :keyword client_secret: Service principal secret. + :paramtype client_secret: str """ super().__init__(**kwargs) - self.secrets_type: str = "Sas" - self.sas_token = sas_token - + self.secrets_type: str = "ServicePrincipal" + self.client_secret = client_secret -class ScaleSettings(_serialization.Model): - """scale settings for AML Compute. - All required parameters must be populated in order to send to Azure. +class ServiceTagDestination(_serialization.Model): + """Service Tag destination for a Service Tag Outbound Rule for the managed network of a machine + learning workspace. - :ivar max_node_count: Max number of nodes to use. Required. - :vartype max_node_count: int - :ivar min_node_count: Min number of nodes to use. - :vartype min_node_count: int - :ivar node_idle_time_before_scale_down: Node Idle Time before scaling down amlCompute. This - string needs to be in the RFC Format. - :vartype node_idle_time_before_scale_down: ~datetime.timedelta + :ivar action: The action enum for networking rule. Known values are: "Allow" and "Deny". + :vartype action: str or ~azure.mgmt.machinelearningservices.models.RuleAction + :ivar address_prefixes: Optional, if provided, the ServiceTag property will be ignored. + :vartype address_prefixes: list[str] + :ivar port_ranges: + :vartype port_ranges: str + :ivar protocol: + :vartype protocol: str + :ivar service_tag: + :vartype service_tag: str """ - _validation = { - "max_node_count": {"required": True}, - } - _attribute_map = { - "max_node_count": {"key": "maxNodeCount", "type": "int"}, - "min_node_count": {"key": "minNodeCount", "type": "int"}, - "node_idle_time_before_scale_down": {"key": "nodeIdleTimeBeforeScaleDown", "type": "duration"}, + "action": {"key": "action", "type": "str"}, + "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, + "port_ranges": {"key": "portRanges", "type": "str"}, + "protocol": {"key": "protocol", "type": "str"}, + "service_tag": {"key": "serviceTag", "type": "str"}, } def __init__( self, *, - max_node_count: int, - min_node_count: int = 0, - node_idle_time_before_scale_down: Optional[datetime.timedelta] = None, + action: Optional[Union[str, "_models.RuleAction"]] = None, + address_prefixes: Optional[List[str]] = None, + port_ranges: Optional[str] = None, + protocol: Optional[str] = None, + service_tag: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword max_node_count: Max number of nodes to use. Required. - :paramtype max_node_count: int - :keyword min_node_count: Min number of nodes to use. - :paramtype min_node_count: int - :keyword node_idle_time_before_scale_down: Node Idle Time before scaling down amlCompute. This - string needs to be in the RFC Format. - :paramtype node_idle_time_before_scale_down: ~datetime.timedelta + :keyword action: The action enum for networking rule. Known values are: "Allow" and "Deny". + :paramtype action: str or ~azure.mgmt.machinelearningservices.models.RuleAction + :keyword address_prefixes: Optional, if provided, the ServiceTag property will be ignored. + :paramtype address_prefixes: list[str] + :keyword port_ranges: + :paramtype port_ranges: str + :keyword protocol: + :paramtype protocol: str + :keyword service_tag: + :paramtype service_tag: str """ super().__init__(**kwargs) - self.max_node_count = max_node_count - self.min_node_count = min_node_count - self.node_idle_time_before_scale_down = node_idle_time_before_scale_down + self.action = action + self.address_prefixes = address_prefixes + self.port_ranges = port_ranges + self.protocol = protocol + self.service_tag = service_tag -class ScaleSettingsInformation(_serialization.Model): - """Desired scale settings for the amlCompute. +class ServiceTagOutboundRule(OutboundRule): + """Service Tag Outbound Rule for the managed network of a machine learning workspace. - :ivar scale_settings: scale settings for AML Compute. - :vartype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + 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 server. + + :ivar category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :vartype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :ivar parent_rule_names: + :vartype parent_rule_names: list[str] + :ivar status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :vartype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :ivar type: Type of a managed network Outbound Rule of a machine learning workspace. Required. + Known values are: "FQDN", "PrivateEndpoint", and "ServiceTag". + :vartype type: str or ~azure.mgmt.machinelearningservices.models.RuleType + :ivar destination: Service Tag destination for a Service Tag Outbound Rule for the managed + network of a machine learning workspace. + :vartype destination: ~azure.mgmt.machinelearningservices.models.ServiceTagDestination """ + _validation = { + "parent_rule_names": {"readonly": True}, + "type": {"required": True}, + } + _attribute_map = { - "scale_settings": {"key": "scaleSettings", "type": "ScaleSettings"}, + "category": {"key": "category", "type": "str"}, + "parent_rule_names": {"key": "parentRuleNames", "type": "[str]"}, + "status": {"key": "status", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "destination": {"key": "destination", "type": "ServiceTagDestination"}, } - def __init__(self, *, scale_settings: Optional["_models.ScaleSettings"] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + category: Optional[Union[str, "_models.RuleCategory"]] = None, + status: Optional[Union[str, "_models.RuleStatus"]] = None, + destination: Optional["_models.ServiceTagDestination"] = None, + **kwargs: Any + ) -> None: """ - :keyword scale_settings: scale settings for AML Compute. - :paramtype scale_settings: ~azure.mgmt.machinelearningservices.models.ScaleSettings + :keyword category: Category of a managed network Outbound Rule of a machine learning workspace. + Known values are: "Required", "Recommended", "UserDefined", and "Dependency". + :paramtype category: str or ~azure.mgmt.machinelearningservices.models.RuleCategory + :keyword status: Type of a managed network Outbound Rule of a machine learning workspace. Known + values are: "Inactive" and "Active". + :paramtype status: str or ~azure.mgmt.machinelearningservices.models.RuleStatus + :keyword destination: Service Tag destination for a Service Tag Outbound Rule for the managed + network of a machine learning workspace. + :paramtype destination: ~azure.mgmt.machinelearningservices.models.ServiceTagDestination """ - super().__init__(**kwargs) - self.scale_settings = scale_settings + super().__init__(category=category, status=status, **kwargs) + self.type: str = "ServiceTag" + self.destination = destination -class Schedule(Resource): - """Azure Resource Manager resource envelope. - - 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. +class SetupScripts(_serialization.Model): + """Details of customized scripts to execute for setting up the cluster. - :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.ScheduleProperties + :ivar scripts: Customized setup scripts. + :vartype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": 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"}, - "properties": {"key": "properties", "type": "ScheduleProperties"}, + "scripts": {"key": "scripts", "type": "ScriptsToExecute"}, } - def __init__(self, *, properties: "_models.ScheduleProperties", **kwargs: Any) -> None: + def __init__(self, *, scripts: Optional["_models.ScriptsToExecute"] = None, **kwargs: Any) -> None: """ - :keyword properties: [Required] Additional attributes of the entity. Required. - :paramtype properties: ~azure.mgmt.machinelearningservices.models.ScheduleProperties + :keyword scripts: Customized setup scripts. + :paramtype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute """ super().__init__(**kwargs) - self.properties = properties + self.scripts = scripts -class ScheduleBase(_serialization.Model): - """ScheduleBase. +class SharedPrivateLinkResource(_serialization.Model): + """SharedPrivateLinkResource. - :ivar id: A system assigned id for the schedule. - :vartype id: str - :ivar provisioning_status: The current deployment state of schedule. Known values are: - "Completed", "Provisioning", and "Failed". - :vartype provisioning_status: str or - ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningState - :ivar status: Is the schedule enabled or disabled?. Known values are: "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus + :ivar name: Unique name of the private link. + :vartype name: str + :ivar group_id: group id of the private link. + :vartype group_id: str + :ivar private_link_resource_id: the resource id that private link links to. + :vartype private_link_resource_id: str + :ivar request_message: Request message. + :vartype request_message: str + :ivar status: Connection status of the service consumer with the service provider. Known values + are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :vartype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ _attribute_map = { - "id": {"key": "id", "type": "str"}, - "provisioning_status": {"key": "provisioningStatus", "type": "str"}, - "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "group_id": {"key": "properties.groupId", "type": "str"}, + "private_link_resource_id": {"key": "properties.privateLinkResourceId", "type": "str"}, + "request_message": {"key": "properties.requestMessage", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, } def __init__( self, *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - provisioning_status: Optional[Union[str, "_models.ScheduleProvisioningState"]] = None, - status: Optional[Union[str, "_models.ScheduleStatus"]] = None, + name: Optional[str] = None, + group_id: Optional[str] = None, + private_link_resource_id: Optional[str] = None, + request_message: Optional[str] = None, + status: Optional[Union[str, "_models.EndpointServiceConnectionStatus"]] = None, **kwargs: Any ) -> None: """ - :keyword id: A system assigned id for the schedule. - :paramtype id: str - :keyword provisioning_status: The current deployment state of schedule. Known values are: - "Completed", "Provisioning", and "Failed". - :paramtype provisioning_status: str or - ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningState - :keyword status: Is the schedule enabled or disabled?. Known values are: "Enabled" and - "Disabled". - :paramtype status: str or ~azure.mgmt.machinelearningservices.models.ScheduleStatus + :keyword name: Unique name of the private link. + :paramtype name: str + :keyword group_id: group id of the private link. + :paramtype group_id: str + :keyword private_link_resource_id: the resource id that private link links to. + :paramtype private_link_resource_id: str + :keyword request_message: Request message. + :paramtype request_message: str + :keyword status: Connection status of the service consumer with the service provider. Known + values are: "Approved", "Pending", "Rejected", "Disconnected", and "Timeout". + :paramtype status: str or + ~azure.mgmt.machinelearningservices.models.EndpointServiceConnectionStatus """ super().__init__(**kwargs) - self.id = id - self.provisioning_status = provisioning_status + self.name = name + self.group_id = group_id + self.private_link_resource_id = private_link_resource_id + self.request_message = request_message self.status = status -class ScheduleProperties(ResourceBase): - """Base definition of a schedule. - - Variables are only populated by the server, and will be ignored when sending a request. +class Sku(_serialization.Model): + """The resource model definition representing SKU. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :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 action: [Required] Specifies the action of the schedule. Required. - :vartype action: ~azure.mgmt.machinelearningservices.models.ScheduleActionBase - :ivar display_name: Display name of schedule. - :vartype display_name: str - :ivar is_enabled: Is the schedule enabled?. - :vartype is_enabled: bool - :ivar provisioning_state: Provisioning state for the schedule. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ScheduleProvisioningStatus - :ivar trigger: [Required] Specifies the trigger details. Required. - :vartype trigger: ~azure.mgmt.machinelearningservices.models.TriggerBase + :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :vartype capacity: int """ _validation = { - "action": {"required": True}, - "provisioning_state": {"readonly": True}, - "trigger": {"required": True}, + "name": {"required": True}, } _attribute_map = { - "description": {"key": "description", "type": "str"}, - "properties": {"key": "properties", "type": "{str}"}, - "tags": {"key": "tags", "type": "{str}"}, - "action": {"key": "action", "type": "ScheduleActionBase"}, - "display_name": {"key": "displayName", "type": "str"}, - "is_enabled": {"key": "isEnabled", "type": "bool"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "trigger": {"key": "trigger", "type": "TriggerBase"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "family": {"key": "family", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, } def __init__( self, *, - action: "_models.ScheduleActionBase", - trigger: "_models.TriggerBase", - description: Optional[str] = None, - properties: Optional[Dict[str, str]] = None, - tags: Optional[Dict[str, str]] = None, - display_name: Optional[str] = None, - is_enabled: bool = True, + name: str, + tier: Optional[Union[str, "_models.SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, **kwargs: Any ) -> None: """ - :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 action: [Required] Specifies the action of the schedule. Required. - :paramtype action: ~azure.mgmt.machinelearningservices.models.ScheduleActionBase - :keyword display_name: Display name of schedule. - :paramtype display_name: str - :keyword is_enabled: Is the schedule enabled?. - :paramtype is_enabled: bool - :keyword trigger: [Required] Specifies the trigger details. Required. - :paramtype trigger: ~azure.mgmt.machinelearningservices.models.TriggerBase + :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int """ - super().__init__(description=description, properties=properties, tags=tags, **kwargs) - self.action = action - self.display_name = display_name - self.is_enabled = is_enabled - self.provisioning_state = None - self.trigger = trigger + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity -class ScheduleResourceArmPaginatedResult(_serialization.Model): - """A paginated list of Schedule entities. +class SkuCapacity(_serialization.Model): + """SKU capacity information. - :ivar next_link: The link to the next page of Schedule objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type Schedule. - :vartype value: list[~azure.mgmt.machinelearningservices.models.Schedule] + :ivar default: Gets or sets the default capacity. + :vartype default: int + :ivar maximum: Gets or sets the maximum. + :vartype maximum: int + :ivar minimum: Gets or sets the minimum. + :vartype minimum: int + :ivar scale_type: Gets or sets the type of the scale. Known values are: "Automatic", "Manual", + and "None". + :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.SkuScaleType """ _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[Schedule]"}, + "default": {"key": "default", "type": "int"}, + "maximum": {"key": "maximum", "type": "int"}, + "minimum": {"key": "minimum", "type": "int"}, + "scale_type": {"key": "scaleType", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.Schedule"]] = None, **kwargs: Any + self, + *, + default: int = 0, + maximum: int = 0, + minimum: int = 0, + scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of Schedule objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type Schedule. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.Schedule] + :keyword default: Gets or sets the default capacity. + :paramtype default: int + :keyword maximum: Gets or sets the maximum. + :paramtype maximum: int + :keyword minimum: Gets or sets the minimum. + :paramtype minimum: int + :keyword scale_type: Gets or sets the type of the scale. Known values are: "Automatic", + "Manual", and "None". + :paramtype scale_type: str or ~azure.mgmt.machinelearningservices.models.SkuScaleType """ super().__init__(**kwargs) - self.next_link = next_link - self.value = value + self.default = default + self.maximum = maximum + self.minimum = minimum + self.scale_type = scale_type -class ScriptReference(_serialization.Model): - """Script reference. +class SkuResource(_serialization.Model): + """Fulfills ARM Contract requirement to list all available SKUS for a resource. - :ivar script_source: The storage source of the script: workspace. - :vartype script_source: str - :ivar script_data: The location of scripts in the mounted volume. - :vartype script_data: str - :ivar script_arguments: Optional command line arguments passed to the script to run. - :vartype script_arguments: str - :ivar timeout: Optional time period passed to timeout command. - :vartype timeout: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar capacity: Gets or sets the Sku Capacity. + :vartype capacity: ~azure.mgmt.machinelearningservices.models.SkuCapacity + :ivar resource_type: The resource type name. + :vartype resource_type: str + :ivar sku: Gets or sets the Sku. + :vartype sku: ~azure.mgmt.machinelearningservices.models.SkuSetting """ + _validation = { + "resource_type": {"readonly": True}, + } + _attribute_map = { - "script_source": {"key": "scriptSource", "type": "str"}, - "script_data": {"key": "scriptData", "type": "str"}, - "script_arguments": {"key": "scriptArguments", "type": "str"}, - "timeout": {"key": "timeout", "type": "str"}, + "capacity": {"key": "capacity", "type": "SkuCapacity"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "sku": {"key": "sku", "type": "SkuSetting"}, } def __init__( self, *, - script_source: Optional[str] = None, - script_data: Optional[str] = None, - script_arguments: Optional[str] = None, - timeout: Optional[str] = None, + capacity: Optional["_models.SkuCapacity"] = None, + sku: Optional["_models.SkuSetting"] = None, **kwargs: Any ) -> None: """ - :keyword script_source: The storage source of the script: workspace. - :paramtype script_source: str - :keyword script_data: The location of scripts in the mounted volume. - :paramtype script_data: str - :keyword script_arguments: Optional command line arguments passed to the script to run. - :paramtype script_arguments: str - :keyword timeout: Optional time period passed to timeout command. - :paramtype timeout: str + :keyword capacity: Gets or sets the Sku Capacity. + :paramtype capacity: ~azure.mgmt.machinelearningservices.models.SkuCapacity + :keyword sku: Gets or sets the Sku. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.SkuSetting """ super().__init__(**kwargs) - self.script_source = script_source - self.script_data = script_data - self.script_arguments = script_arguments - self.timeout = timeout + self.capacity = capacity + self.resource_type = None + self.sku = sku -class ScriptsToExecute(_serialization.Model): - """Customized setup scripts. +class SkuResourceArmPaginatedResult(_serialization.Model): + """A paginated list of SkuResource entities. - :ivar startup_script: Script that's run every time the machine starts. - :vartype startup_script: ~azure.mgmt.machinelearningservices.models.ScriptReference - :ivar creation_script: Script that's run only once during provision of the compute. - :vartype creation_script: ~azure.mgmt.machinelearningservices.models.ScriptReference + :ivar next_link: The link to the next page of SkuResource objects. If null, there are no + additional pages. + :vartype next_link: str + :ivar value: An array of objects of type SkuResource. + :vartype value: list[~azure.mgmt.machinelearningservices.models.SkuResource] """ _attribute_map = { - "startup_script": {"key": "startupScript", "type": "ScriptReference"}, - "creation_script": {"key": "creationScript", "type": "ScriptReference"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[SkuResource]"}, } def __init__( - self, - *, - startup_script: Optional["_models.ScriptReference"] = None, - creation_script: Optional["_models.ScriptReference"] = None, - **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.SkuResource"]] = None, **kwargs: Any ) -> None: """ - :keyword startup_script: Script that's run every time the machine starts. - :paramtype startup_script: ~azure.mgmt.machinelearningservices.models.ScriptReference - :keyword creation_script: Script that's run only once during provision of the compute. - :paramtype creation_script: ~azure.mgmt.machinelearningservices.models.ScriptReference + :keyword next_link: The link to the next page of SkuResource objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type SkuResource. + :paramtype value: list[~azure.mgmt.machinelearningservices.models.SkuResource] """ super().__init__(**kwargs) - self.startup_script = startup_script - self.creation_script = creation_script + self.next_link = next_link + self.value = value -class ServiceManagedResourcesSettings(_serialization.Model): - """ServiceManagedResourcesSettings. +class SkuSetting(_serialization.Model): + """SkuSetting fulfills the need for stripped down SKU info in ARM contract. - :ivar cosmos_db: The settings for the service managed cosmosdb account. - :vartype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + All required parameters must be populated in order to send to server. + + :ivar name: [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. + Required. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ + _validation = { + "name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + } + _attribute_map = { - "cosmos_db": {"key": "cosmosDb", "type": "CosmosDbSettings"}, + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, } - def __init__(self, *, cosmos_db: Optional["_models.CosmosDbSettings"] = None, **kwargs: Any) -> None: + def __init__(self, *, name: str, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any) -> None: """ - :keyword cosmos_db: The settings for the service managed cosmosdb account. - :paramtype cosmos_db: ~azure.mgmt.machinelearningservices.models.CosmosDbSettings + :keyword name: [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. + Required. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", + "Standard", and "Premium". + :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier """ super().__init__(**kwargs) - self.cosmos_db = cosmos_db + self.name = name + self.tier = tier -class ServicePrincipalDatastoreCredentials(DatastoreCredentials): - """Service Principal datastore credentials configuration. +class SparkJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes + """Spark job definition. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar credentials_type: [Required] Credential type used to authentication with storage. - Required. Known values are: "AccountKey", "Certificate", "None", "Sas", and "ServicePrincipal". - :vartype credentials_type: str or ~azure.mgmt.machinelearningservices.models.CredentialsType - :ivar authority_url: Authority URL used for authentication. - :vartype authority_url: str - :ivar client_id: [Required] Service principal client ID. Required. - :vartype client_id: str - :ivar resource_url: Resource the service principal has access to. - :vartype resource_url: str - :ivar secrets: [Required] Service principal secrets. Required. - :vartype secrets: ~azure.mgmt.machinelearningservices.models.ServicePrincipalDatastoreSecrets - :ivar tenant_id: [Required] ID of the tenant to which the service principal belongs. Required. - :vartype tenant_id: str + All required parameters must be populated in order to send to server. + + :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", "Sweep", "Pipeline", "Spark", and "FineTuning". + :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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". + :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-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 environment_variables: Environment variables included in the job. + :vartype environment_variables: dict[str, 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 queue_settings: Queue settings for the job. + :vartype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :ivar resources: Compute Resource configuration for the job. + :vartype resources: ~azure.mgmt.machinelearningservices.models.SparkResourceConfiguration """ _validation = { - "credentials_type": {"required": True}, - "client_id": {"required": True}, - "secrets": {"required": True}, - "tenant_id": {"required": True}, + "job_type": {"required": True}, + "status": {"readonly": True}, + "code_id": {"required": True}, + "entry": {"required": True}, } _attribute_map = { - "credentials_type": {"key": "credentialsType", "type": "str"}, - "authority_url": {"key": "authorityUrl", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - "resource_url": {"key": "resourceUrl", "type": "str"}, - "secrets": {"key": "secrets", "type": "ServicePrincipalDatastoreSecrets"}, - "tenant_id": {"key": "tenantId", "type": "str"}, + "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"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, + "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"}, + "environment_variables": {"key": "environmentVariables", "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]"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, + "resources": {"key": "resources", "type": "SparkResourceConfiguration"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, - client_id: str, - secrets: "_models.ServicePrincipalDatastoreSecrets", - tenant_id: str, - authority_url: Optional[str] = None, - resource_url: Optional[str] = None, + 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, + notification_setting: Optional["_models.NotificationSetting"] = None, + 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, + environment_variables: Optional[Dict[str, 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, + queue_settings: Optional["_models.QueueSettings"] = None, + resources: Optional["_models.SparkResourceConfiguration"] = None, **kwargs: Any ) -> None: """ - :keyword authority_url: Authority URL used for authentication. - :paramtype authority_url: str - :keyword client_id: [Required] Service principal client ID. Required. - :paramtype client_id: str - :keyword resource_url: Resource the service principal has access to. - :paramtype resource_url: str - :keyword secrets: [Required] Service principal secrets. Required. - :paramtype secrets: ~azure.mgmt.machinelearningservices.models.ServicePrincipalDatastoreSecrets - :keyword tenant_id: [Required] ID of the tenant to which the service principal belongs. - Required. - :paramtype tenant_id: str + :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 notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting + :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-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 environment_variables: Environment variables included in the job. + :paramtype environment_variables: dict[str, 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 queue_settings: Queue settings for the job. + :paramtype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings + :keyword resources: Compute Resource configuration for the job. + :paramtype resources: ~azure.mgmt.machinelearningservices.models.SparkResourceConfiguration """ - super().__init__(**kwargs) - self.credentials_type: str = "ServicePrincipal" - self.authority_url = authority_url - self.client_id = client_id - self.resource_url = resource_url - self.secrets = secrets - self.tenant_id = tenant_id + 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, + notification_setting=notification_setting, + 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.environment_variables = environment_variables + self.files = files + self.inputs = inputs + self.jars = jars + self.outputs = outputs + self.py_files = py_files + self.queue_settings = queue_settings + self.resources = resources -class ServicePrincipalDatastoreSecrets(DatastoreSecrets): - """Datastore Service Principal secrets. +class SparkJobEntry(_serialization.Model): + """Spark job entry point definition. - All required parameters must be populated in order to send to Azure. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + SparkJobPythonEntry, SparkJobScalaEntry - :ivar secrets_type: [Required] Credential type used to authentication with storage. Required. - Known values are: "AccountKey", "Certificate", "Sas", and "ServicePrincipal". - :vartype secrets_type: str or ~azure.mgmt.machinelearningservices.models.SecretsType - :ivar client_secret: Service principal secret. - :vartype client_secret: str + All required parameters must be populated in order to send to server. + + :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 = { - "secrets_type": {"required": True}, - } - - _attribute_map = { - "secrets_type": {"key": "secretsType", "type": "str"}, - "client_secret": {"key": "clientSecret", "type": "str"}, + "spark_job_entry_type": {"required": True}, } - def __init__(self, *, client_secret: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_secret: Service principal secret. - :paramtype client_secret: str - """ - super().__init__(**kwargs) - self.secrets_type: str = "ServicePrincipal" - self.client_secret = client_secret - - -class SetupScripts(_serialization.Model): - """Details of customized scripts to execute for setting up the cluster. - - :ivar scripts: Customized setup scripts. - :vartype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute - """ - _attribute_map = { - "scripts": {"key": "scripts", "type": "ScriptsToExecute"}, + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, } - def __init__(self, *, scripts: Optional["_models.ScriptsToExecute"] = None, **kwargs: Any) -> None: - """ - :keyword scripts: Customized setup scripts. - :paramtype scripts: ~azure.mgmt.machinelearningservices.models.ScriptsToExecute - """ - super().__init__(**kwargs) - self.scripts = scripts - - -class SharedPrivateLinkResource(_serialization.Model): - """SharedPrivateLinkResource. - - :ivar name: Unique name of the private link. - :vartype name: str - :ivar private_link_resource_id: The resource id that private link links to. - :vartype private_link_resource_id: str - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar request_message: Request message. - :vartype request_message: str - :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Known values are: "Pending", "Approved", "Rejected", "Disconnected", and - "Timeout". - :vartype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "private_link_resource_id": {"key": "properties.privateLinkResourceId", "type": "str"}, - "group_id": {"key": "properties.groupId", "type": "str"}, - "request_message": {"key": "properties.requestMessage", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, + _subtype_map = { + "spark_job_entry_type": { + "SparkJobPythonEntry": "SparkJobPythonEntry", + "SparkJobScalaEntry": "SparkJobScalaEntry", + } } - def __init__( - self, - *, - name: Optional[str] = None, - private_link_resource_id: Optional[str] = None, - group_id: Optional[str] = None, - request_message: Optional[str] = None, - status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Unique name of the private link. - :paramtype name: str - :keyword private_link_resource_id: The resource id that private link links to. - :paramtype private_link_resource_id: str - :keyword group_id: The private link resource group id. - :paramtype group_id: str - :keyword request_message: Request message. - :paramtype request_message: str - :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the - owner of the service. Known values are: "Pending", "Approved", "Rejected", "Disconnected", and - "Timeout". - :paramtype status: str or - ~azure.mgmt.machinelearningservices.models.PrivateEndpointServiceConnectionStatus - """ + def __init__(self, **kwargs: Any) -> None: + """ """ super().__init__(**kwargs) - self.name = name - self.private_link_resource_id = private_link_resource_id - self.group_id = group_id - self.request_message = request_message - self.status = status + self.spark_job_entry_type: Optional[str] = None -class Sku(_serialization.Model): - """The resource model definition representing SKU. +class SparkJobPythonEntry(SparkJobEntry): + """SparkJobPythonEntry. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. - :ivar name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier - :ivar size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :vartype size: str - :ivar family: If the service has different generations of hardware, for the same SKU, then that - can be captured here. - :vartype family: str - :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :vartype capacity: int + :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 = { - "name": {"required": True}, + "spark_job_entry_type": {"required": True}, + "file": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, } _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "size": {"key": "size", "type": "str"}, - "family": {"key": "family", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + "file": {"key": "file", "type": "str"}, } - def __init__( - self, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, file: str, **kwargs: Any) -> None: """ - :keyword name: The name of the SKU. Ex - P3. It is typically a letter+number code. Required. - :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier - :keyword size: The SKU size. When the name field is the combination of tier and some other - value, this would be the standalone code. - :paramtype size: str - :keyword family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :paramtype family: str - :keyword capacity: If the SKU supports scale out/in then the capacity integer should be - included. If scale out/in is not possible for the resource this may be omitted. - :paramtype capacity: int + :keyword file: [Required] Relative python file path for job entry point. Required. + :paramtype file: str """ super().__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity + self.spark_job_entry_type: str = "SparkJobPythonEntry" + self.file = file -class SkuCapacity(_serialization.Model): - """SKU capacity information. +class SparkJobScalaEntry(SparkJobEntry): + """SparkJobScalaEntry. - :ivar default: Gets or sets the default capacity. - :vartype default: int - :ivar maximum: Gets or sets the maximum. - :vartype maximum: int - :ivar minimum: Gets or sets the minimum. - :vartype minimum: int - :ivar scale_type: Gets or sets the type of the scale. Known values are: "Automatic", "Manual", - and "None". - :vartype scale_type: str or ~azure.mgmt.machinelearningservices.models.SkuScaleType + All required parameters must be populated in order to send to server. + + :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 = { - "default": {"key": "default", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "minimum": {"key": "minimum", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, + "spark_job_entry_type": {"key": "sparkJobEntryType", "type": "str"}, + "class_name": {"key": "className", "type": "str"}, } - def __init__( - self, - *, - default: int = 0, - maximum: int = 0, - minimum: int = 0, - scale_type: Optional[Union[str, "_models.SkuScaleType"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, class_name: str, **kwargs: Any) -> None: """ - :keyword default: Gets or sets the default capacity. - :paramtype default: int - :keyword maximum: Gets or sets the maximum. - :paramtype maximum: int - :keyword minimum: Gets or sets the minimum. - :paramtype minimum: int - :keyword scale_type: Gets or sets the type of the scale. Known values are: "Automatic", - "Manual", and "None". - :paramtype scale_type: str or ~azure.mgmt.machinelearningservices.models.SkuScaleType + :keyword class_name: [Required] Scala class name used as entry point. Required. + :paramtype class_name: str """ super().__init__(**kwargs) - self.default = default - self.maximum = maximum - self.minimum = minimum - self.scale_type = scale_type + self.spark_job_entry_type: str = "SparkJobScalaEntry" + self.class_name = class_name -class SkuResource(_serialization.Model): - """Fulfills ARM Contract requirement to list all available SKUS for a resource. - - Variables are only populated by the server, and will be ignored when sending a request. +class SparkResourceConfiguration(_serialization.Model): + """SparkResourceConfiguration. - :ivar capacity: Gets or sets the Sku Capacity. - :vartype capacity: ~azure.mgmt.machinelearningservices.models.SkuCapacity - :ivar resource_type: The resource type name. - :vartype resource_type: str - :ivar sku: Gets or sets the Sku. - :vartype sku: ~azure.mgmt.machinelearningservices.models.SkuSetting + :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 """ - _validation = { - "resource_type": {"readonly": True}, - } - _attribute_map = { - "capacity": {"key": "capacity", "type": "SkuCapacity"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "sku": {"key": "sku", "type": "SkuSetting"}, + "instance_type": {"key": "instanceType", "type": "str"}, + "runtime_version": {"key": "runtimeVersion", "type": "str"}, } - def __init__( - self, - *, - capacity: Optional["_models.SkuCapacity"] = None, - sku: Optional["_models.SkuSetting"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, instance_type: Optional[str] = None, runtime_version: str = "3.1", **kwargs: Any) -> None: """ - :keyword capacity: Gets or sets the Sku Capacity. - :paramtype capacity: ~azure.mgmt.machinelearningservices.models.SkuCapacity - :keyword sku: Gets or sets the Sku. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.SkuSetting + :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.capacity = capacity - self.resource_type = None - self.sku = sku + self.instance_type = instance_type + self.runtime_version = runtime_version -class SkuResourceArmPaginatedResult(_serialization.Model): - """A paginated list of SkuResource entities. +class SpeechEndpointDeploymentResourceProperties( + CognitiveServiceEndpointDeploymentResourceProperties, EndpointDeploymentResourceProperties +): # pylint: disable=name-too-long + """SpeechEndpointDeploymentResourceProperties. - :ivar next_link: The link to the next page of SkuResource objects. If null, there are no - additional pages. - :vartype next_link: str - :ivar value: An array of objects of type SkuResource. - :vartype value: list[~azure.mgmt.machinelearningservices.models.SkuResource] + 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 server. + + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar type: Kind of the deployment. Required. + :vartype type: str + :ivar model: Model used for the endpoint deployment. Required. + :vartype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :ivar rai_policy_name: The name of RAI policy. + :vartype rai_policy_name: str + :ivar sku: + :vartype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :ivar version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :vartype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ + _validation = { + "provisioning_state": {"readonly": True}, + "type": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "model": {"required": True}, + } + _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[SkuResource]"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "model": {"key": "model", "type": "EndpointDeploymentModel"}, + "rai_policy_name": {"key": "raiPolicyName", "type": "str"}, + "sku": {"key": "sku", "type": "CognitiveServicesSku"}, + "version_upgrade_option": {"key": "versionUpgradeOption", "type": "str"}, } def __init__( - self, *, next_link: Optional[str] = None, value: Optional[List["_models.SkuResource"]] = None, **kwargs: Any + self, + *, + model: "_models.EndpointDeploymentModel", + failure_reason: Optional[str] = None, + rai_policy_name: Optional[str] = None, + sku: Optional["_models.CognitiveServicesSku"] = None, + version_upgrade_option: Optional[Union[str, "_models.DeploymentModelVersionUpgradeOption"]] = None, + **kwargs: Any ) -> None: """ - :keyword next_link: The link to the next page of SkuResource objects. If null, there are no - additional pages. - :paramtype next_link: str - :keyword value: An array of objects of type SkuResource. - :paramtype value: list[~azure.mgmt.machinelearningservices.models.SkuResource] + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword model: Model used for the endpoint deployment. Required. + :paramtype model: ~azure.mgmt.machinelearningservices.models.EndpointDeploymentModel + :keyword rai_policy_name: The name of RAI policy. + :paramtype rai_policy_name: str + :keyword sku: + :paramtype sku: ~azure.mgmt.machinelearningservices.models.CognitiveServicesSku + :keyword version_upgrade_option: Deployment model version upgrade option. Known values are: + "OnceNewDefaultVersionAvailable", "OnceCurrentVersionExpired", and "NoAutoUpgrade". + :paramtype version_upgrade_option: str or + ~azure.mgmt.machinelearningservices.models.DeploymentModelVersionUpgradeOption """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value + super().__init__( + model=model, + rai_policy_name=rai_policy_name, + sku=sku, + version_upgrade_option=version_upgrade_option, + failure_reason=failure_reason, + **kwargs + ) + self.failure_reason = failure_reason + self.provisioning_state = None + self.type: str = "Azure.Speech" + self.model = model + self.rai_policy_name = rai_policy_name + self.sku = sku + self.version_upgrade_option = version_upgrade_option -class SkuSetting(_serialization.Model): - """SkuSetting fulfills the need for stripped down SKU info in ARM contract. +class SpeechEndpointResourceProperties(EndpointResourceProperties): + """SpeechEndpointResourceProperties. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. - Required. + All required parameters must be populated in order to send to server. + + :ivar associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :vartype associated_resource_id: str + :ivar deployments: Deployments info. + :vartype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :ivar endpoint_type: Type of the endpoint. Required. Known values are: "Azure.OpenAI", + "Azure.Speech", "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and + "serverlessEndpoint". + :vartype endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :ivar endpoint_uri: Uri of the endpoint. + :vartype endpoint_uri: str + :ivar failure_reason: The failure reason if the creation failed. + :vartype failure_reason: str + :ivar location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :vartype location: str + :ivar name: Name of the endpoint. :vartype name: str - :ivar tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :ivar provisioning_state: Read-only provision state status property. Known values are: + "NotStarted", "Failed", "Creating", "Updating", "Succeeded", "Deleting", "Accepted", + "Canceled", "Scaling", and "Disabled". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.DefaultResourceProvisioningState + :ivar should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :vartype should_create_ai_services_endpoint: bool """ _validation = { - "name": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "endpoint_type": {"required": True}, + "provisioning_state": {"readonly": True}, } _attribute_map = { + "associated_resource_id": {"key": "associatedResourceId", "type": "str"}, + "deployments": {"key": "deployments", "type": "[EndpointDeploymentResourcePropertiesBasicResource]"}, + "endpoint_type": {"key": "endpointType", "type": "str"}, + "endpoint_uri": {"key": "endpointUri", "type": "str"}, + "failure_reason": {"key": "failureReason", "type": "str"}, + "location": {"key": "location", "type": "str"}, "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "should_create_ai_services_endpoint": {"key": "shouldCreateAiServicesEndpoint", "type": "bool"}, } - def __init__(self, *, name: str, tier: Optional[Union[str, "_models.SkuTier"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + associated_resource_id: Optional[str] = None, + deployments: Optional[List["_models.EndpointDeploymentResourcePropertiesBasicResource"]] = None, + endpoint_uri: Optional[str] = None, + failure_reason: Optional[str] = None, + location: Optional[str] = None, + name: Optional[str] = None, + should_create_ai_services_endpoint: Optional[bool] = None, + **kwargs: Any + ) -> None: """ - :keyword name: [Required] The name of the SKU. Ex - P3. It is typically a letter+number code. - Required. + :keyword associated_resource_id: Byo resource id for creating the built-in model service + endpoints. + :paramtype associated_resource_id: str + :keyword deployments: Deployments info. + :paramtype deployments: + list[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :keyword endpoint_uri: Uri of the endpoint. + :paramtype endpoint_uri: str + :keyword failure_reason: The failure reason if the creation failed. + :paramtype failure_reason: str + :keyword location: Location of the endpoint. + Since input dto and when parse endpoint resource share the same contract + this Location field is just for parse the endpoint resource info + we won't let customer specify the endpoint resource location since we will create it the same + location as workspace. + :paramtype location: str + :keyword name: Name of the endpoint. :paramtype name: str - :keyword tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Known values are: "Free", "Basic", - "Standard", and "Premium". - :paramtype tier: str or ~azure.mgmt.machinelearningservices.models.SkuTier + :keyword should_create_ai_services_endpoint: Whether the proxy (non-byo) endpoint is a regular + endpoint or a OneKeyV2 AI services account endpoint. + :paramtype should_create_ai_services_endpoint: bool """ - super().__init__(**kwargs) - self.name = name - self.tier = tier + super().__init__( + associated_resource_id=associated_resource_id, + deployments=deployments, + endpoint_uri=endpoint_uri, + failure_reason=failure_reason, + location=location, + name=name, + should_create_ai_services_endpoint=should_create_ai_services_endpoint, + **kwargs + ) + self.endpoint_type: str = "Azure.Speech" class SslConfiguration(_serialization.Model): @@ -19516,6 +31250,90 @@ def __init__( self.stack_meta_learner_type = stack_meta_learner_type +class StaticInputData(MonitoringInputDataBase): + """Static input data definition. + + All required parameters must be populated in order to send to server. + + :ivar columns: Mapping of column names to special uses. + :vartype columns: dict[str, str] + :ivar data_context: The context metadata of the data source. + :vartype data_context: str + :ivar input_data_type: [Required] Specifies the type of signal to monitor. Required. Known + values are: "Static", "Rolling", and "Fixed". + :vartype input_data_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringInputDataType + :ivar job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :vartype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :ivar uri: [Required] Input Asset URI. Required. + :vartype uri: str + :ivar preprocessing_component_id: Reference to the component asset used to preprocess the data. + :vartype preprocessing_component_id: str + :ivar window_end: [Required] The end date of the data window. Required. + :vartype window_end: ~datetime.datetime + :ivar window_start: [Required] The start date of the data window. Required. + :vartype window_start: ~datetime.datetime + """ + + _validation = { + "input_data_type": {"required": True}, + "job_input_type": {"required": True}, + "uri": {"required": True, "min_length": 1, "pattern": r"[a-zA-Z0-9_]"}, + "window_end": {"required": True}, + "window_start": {"required": True}, + } + + _attribute_map = { + "columns": {"key": "columns", "type": "{str}"}, + "data_context": {"key": "dataContext", "type": "str"}, + "input_data_type": {"key": "inputDataType", "type": "str"}, + "job_input_type": {"key": "jobInputType", "type": "str"}, + "uri": {"key": "uri", "type": "str"}, + "preprocessing_component_id": {"key": "preprocessingComponentId", "type": "str"}, + "window_end": {"key": "windowEnd", "type": "iso-8601"}, + "window_start": {"key": "windowStart", "type": "iso-8601"}, + } + + def __init__( + self, + *, + job_input_type: Union[str, "_models.JobInputType"], + uri: str, + window_end: datetime.datetime, + window_start: datetime.datetime, + columns: Optional[Dict[str, str]] = None, + data_context: Optional[str] = None, + preprocessing_component_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword columns: Mapping of column names to special uses. + :paramtype columns: dict[str, str] + :keyword data_context: The context metadata of the data source. + :paramtype data_context: str + :keyword job_input_type: [Required] Specifies the type of job. Required. Known values are: + "literal", "uri_file", "uri_folder", "mltable", "custom_model", "mlflow_model", and + "triton_model". + :paramtype job_input_type: str or ~azure.mgmt.machinelearningservices.models.JobInputType + :keyword uri: [Required] Input Asset URI. Required. + :paramtype uri: str + :keyword preprocessing_component_id: Reference to the component asset used to preprocess the + data. + :paramtype preprocessing_component_id: str + :keyword window_end: [Required] The end date of the data window. Required. + :paramtype window_end: ~datetime.datetime + :keyword window_start: [Required] The start date of the data window. Required. + :paramtype window_start: ~datetime.datetime + """ + super().__init__(columns=columns, data_context=data_context, job_input_type=job_input_type, uri=uri, **kwargs) + self.input_data_type: str = "Static" + self.preprocessing_component_id = preprocessing_component_id + self.window_end = window_end + self.window_start = window_start + + class StorageAccountDetails(_serialization.Model): """Details of storage account to be used for the Registry. @@ -19556,12 +31374,66 @@ def __init__( self.user_created_storage_account = user_created_storage_account +class StringArmPaginatedResult(_serialization.Model): + """A paginated list of String entities. + + :ivar next_link: The link to the next page of String objects. If null, there are no additional + pages. + :vartype next_link: str + :ivar value: An array of objects of type String. + :vartype value: list[str] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[str]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, value: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link to the next page of String objects. If null, there are no + additional pages. + :paramtype next_link: str + :keyword value: An array of objects of type String. + :paramtype value: list[str] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class StringKeyValuePair(_serialization.Model): + """StringKeyValuePair. + + :ivar key: + :vartype key: str + :ivar value: + :vartype value: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + "value": {"key": "value", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + :keyword value: + :paramtype value: str + """ + super().__init__(**kwargs) + self.key = key + self.value = value + + class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attributes """Sweep 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. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -19585,8 +31457,10 @@ 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", "Sweep", "Pipeline", "Spark", and "FineTuning". :vartype job_type: str or ~azure.mgmt.machinelearningservices.models.JobType + :ivar notification_setting: Notification setting for the job. + :vartype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -19605,6 +31479,8 @@ class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attribut :vartype objective: ~azure.mgmt.machinelearningservices.models.Objective :ivar outputs: Mapping of output data bindings used in the job. :vartype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :ivar queue_settings: Queue settings for the job. + :vartype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings :ivar sampling_algorithm: [Required] The hyperparameter sampling algorithm. Required. :vartype sampling_algorithm: ~azure.mgmt.machinelearningservices.models.SamplingAlgorithm :ivar search_space: [Required] A dictionary containing each parameter and its distribution. The @@ -19634,6 +31510,7 @@ class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attribut "identity": {"key": "identity", "type": "IdentityConfiguration"}, "is_archived": {"key": "isArchived", "type": "bool"}, "job_type": {"key": "jobType", "type": "str"}, + "notification_setting": {"key": "notificationSetting", "type": "NotificationSetting"}, "services": {"key": "services", "type": "{JobService}"}, "status": {"key": "status", "type": "str"}, "early_termination": {"key": "earlyTermination", "type": "EarlyTerminationPolicy"}, @@ -19641,6 +31518,7 @@ class SweepJob(JobBaseProperties): # pylint: disable=too-many-instance-attribut "limits": {"key": "limits", "type": "SweepJobLimits"}, "objective": {"key": "objective", "type": "Objective"}, "outputs": {"key": "outputs", "type": "{JobOutput}"}, + "queue_settings": {"key": "queueSettings", "type": "QueueSettings"}, "sampling_algorithm": {"key": "samplingAlgorithm", "type": "SamplingAlgorithm"}, "search_space": {"key": "searchSpace", "type": "object"}, "trial": {"key": "trial", "type": "TrialComponent"}, @@ -19662,11 +31540,13 @@ def __init__( experiment_name: str = "Default", identity: Optional["_models.IdentityConfiguration"] = None, is_archived: bool = False, + notification_setting: Optional["_models.NotificationSetting"] = None, services: Optional[Dict[str, "_models.JobService"]] = None, early_termination: Optional["_models.EarlyTerminationPolicy"] = None, inputs: Optional[Dict[str, "_models.JobInput"]] = None, limits: Optional["_models.SweepJobLimits"] = None, outputs: Optional[Dict[str, "_models.JobOutput"]] = None, + queue_settings: Optional["_models.QueueSettings"] = None, **kwargs: Any ) -> None: """ @@ -19691,6 +31571,8 @@ def __init__( :paramtype identity: ~azure.mgmt.machinelearningservices.models.IdentityConfiguration :keyword is_archived: Is the asset archived?. :paramtype is_archived: bool + :keyword notification_setting: Notification setting for the job. + :paramtype notification_setting: ~azure.mgmt.machinelearningservices.models.NotificationSetting :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] @@ -19705,6 +31587,8 @@ def __init__( :paramtype objective: ~azure.mgmt.machinelearningservices.models.Objective :keyword outputs: Mapping of output data bindings used in the job. :paramtype outputs: dict[str, ~azure.mgmt.machinelearningservices.models.JobOutput] + :keyword queue_settings: Queue settings for the job. + :paramtype queue_settings: ~azure.mgmt.machinelearningservices.models.QueueSettings :keyword sampling_algorithm: [Required] The hyperparameter sampling algorithm. Required. :paramtype sampling_algorithm: ~azure.mgmt.machinelearningservices.models.SamplingAlgorithm :keyword search_space: [Required] A dictionary containing each parameter and its distribution. @@ -19723,6 +31607,7 @@ def __init__( experiment_name=experiment_name, identity=identity, is_archived=is_archived, + notification_setting=notification_setting, services=services, **kwargs ) @@ -19732,6 +31617,7 @@ def __init__( self.limits = limits self.objective = objective self.outputs = outputs + self.queue_settings = queue_settings self.sampling_algorithm = sampling_algorithm self.search_space = search_space self.trial = trial @@ -19740,7 +31626,7 @@ def __init__( class SweepJobLimits(JobLimits): """Sweep Job limit class. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar job_limits_type: [Required] JobLimit type. Required. Known values are: "Command" and "Sweep". @@ -19800,7 +31686,7 @@ class SynapseSpark(Compute): # pylint: disable=too-many-instance-attributes 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. + All required parameters must be populated in order to send to server. :ivar compute_type: The type of compute. Required. Known values are: "AKS", "Kubernetes", "AmlCompute", "ComputeInstance", "DataFactory", "VirtualMachine", "HDInsight", "Databricks", @@ -20335,7 +32221,7 @@ def __init__( class TargetUtilizationScaleSettings(OnlineScaleSettings): """TargetUtilizationScaleSettings. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar scale_type: [Required] Type of deployment scaling algorithm. Required. Known values are: "Default" and "TargetUtilization". @@ -20396,7 +32282,7 @@ def __init__( class TensorFlow(DistributionConfiguration): """TensorFlow distribution configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar distribution_type: [Required] Specifies the type of distribution framework. Required. Known values are: "PyTorch", "TensorFlow", and "Mpi". @@ -20434,7 +32320,7 @@ class TextClassification(NlpVertical, AutoMLVertical): """Text Classification task in AutoML NLP vertical. NLP - Natural Language Processing. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", "Warning", "Error", and "Critical". @@ -20538,7 +32424,7 @@ class TextClassificationMultilabel(NlpVertical, AutoMLVertical): 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. + All required parameters must be populated in order to send to server. :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", "Warning", "Error", and "Critical". @@ -20639,7 +32525,7 @@ class TextNer(NlpVertical, AutoMLVertical): 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. + All required parameters must be populated in order to send to server. :ivar log_verbosity: Log verbosity for the job. Known values are: "NotSet", "Debug", "Info", "Warning", "Error", and "Critical". @@ -20734,7 +32620,7 @@ def __init__( class TmpfsOptions(_serialization.Model): - """Describes the tmpfs options for the container. + """TmpfsOptions. :ivar size: Mention the Tmpfs size. :vartype size: int @@ -20753,10 +32639,43 @@ def __init__(self, *, size: Optional[int] = None, **kwargs: Any) -> None: self.size = size +class TopNFeaturesByAttribution(MonitoringFeatureFilterBase): + """TopNFeaturesByAttribution. + + All required parameters must be populated in order to send to server. + + :ivar filter_type: [Required] Specifies the feature filter to leverage when selecting features + to calculate metrics over. Required. Known values are: "AllFeatures", "TopNByAttribution", and + "FeatureSubset". + :vartype filter_type: str or + ~azure.mgmt.machinelearningservices.models.MonitoringFeatureFilterType + :ivar top: The number of top features to include. + :vartype top: int + """ + + _validation = { + "filter_type": {"required": True}, + } + + _attribute_map = { + "filter_type": {"key": "filterType", "type": "str"}, + "top": {"key": "top", "type": "int"}, + } + + def __init__(self, *, top: int = 10, **kwargs: Any) -> None: + """ + :keyword top: The number of top features to include. + :paramtype top: int + """ + super().__init__(**kwargs) + self.filter_type: str = "TopNByAttribution" + self.top = top + + class TrialComponent(_serialization.Model): """Trial component definition. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar code_id: ARM resource ID of the code asset. :vartype code_id: str @@ -20829,7 +32748,7 @@ def __init__( class TritonModelJobInput(AssetJobInput, JobInput): """TritonModelJobInput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the input. :vartype description: str @@ -20883,14 +32802,17 @@ def __init__( class TritonModelJobOutput(AssetJobOutput, JobOutput): """TritonModelJobOutput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the output. :vartype description: str :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 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 @@ -20903,6 +32825,7 @@ class TritonModelJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -20911,6 +32834,7 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs: Any @@ -20918,14 +32842,18 @@ 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 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, mode=mode, uri=uri, description=description, **kwargs) self.description = description self.job_output_type: str = "triton_model" + self.asset_name = asset_name self.mode = mode self.uri = uri @@ -20934,7 +32862,7 @@ class TruncationSelectionPolicy(EarlyTerminationPolicy): """Defines an early termination policy that cancels a given percentage of runs at each evaluation interval. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar delay_evaluation: Number of intervals by which to delay the first evaluation. :vartype delay_evaluation: int @@ -21059,7 +32987,7 @@ def __init__(self, **kwargs: Any) -> None: class UriFileDataVersion(DataVersionBaseProperties): """uri-file data version entity. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -21135,7 +33063,7 @@ def __init__( class UriFileJobInput(AssetJobInput, JobInput): """UriFileJobInput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the input. :vartype description: str @@ -21189,14 +33117,17 @@ def __init__( class UriFileJobOutput(AssetJobOutput, JobOutput): """UriFileJobOutput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the output. :vartype description: str :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 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 @@ -21209,6 +33140,7 @@ class UriFileJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21217,6 +33149,7 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs: Any @@ -21224,14 +33157,18 @@ 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 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, mode=mode, uri=uri, description=description, **kwargs) self.description = description self.job_output_type: str = "uri_file" + self.asset_name = asset_name self.mode = mode self.uri = uri @@ -21239,7 +33176,7 @@ def __init__( class UriFolderDataVersion(DataVersionBaseProperties): """uri-folder data version entity. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: The asset description text. :vartype description: str @@ -21315,7 +33252,7 @@ def __init__( class UriFolderJobInput(AssetJobInput, JobInput): """UriFolderJobInput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the input. :vartype description: str @@ -21369,14 +33306,17 @@ def __init__( class UriFolderJobOutput(AssetJobOutput, JobOutput): """UriFolderJobOutput. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar description: Description for the output. :vartype description: str :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 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 @@ -21389,6 +33329,7 @@ class UriFolderJobOutput(AssetJobOutput, JobOutput): _attribute_map = { "description": {"key": "description", "type": "str"}, "job_output_type": {"key": "jobOutputType", "type": "str"}, + "asset_name": {"key": "assetName", "type": "str"}, "mode": {"key": "mode", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } @@ -21397,6 +33338,7 @@ def __init__( self, *, description: Optional[str] = None, + asset_name: Optional[str] = None, mode: Optional[Union[str, "_models.OutputDeliveryMode"]] = None, uri: Optional[str] = None, **kwargs: Any @@ -21404,14 +33346,18 @@ 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 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, mode=mode, uri=uri, description=description, **kwargs) self.description = description self.job_output_type: str = "uri_folder" + self.asset_name = asset_name self.mode = mode self.uri = uri @@ -21500,7 +33446,7 @@ def __init__(self, **kwargs: Any) -> None: class UserAccountCredentials(_serialization.Model): """Settings for user account that gets created on each on the nodes of a compute. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar admin_user_name: Name of the administrator user account which can be used to SSH to nodes. Required. @@ -21615,7 +33561,7 @@ def __init__(self, *, arm_resource_id: Optional["_models.ArmResourceId"] = None, class UserIdentity(IdentityConfiguration): """User identity configuration. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar identity_type: [Required] Specifies the type of identity framework. Required. Known values are: "Managed", "AMLToken", and "UserIdentity". @@ -21637,23 +33583,61 @@ def __init__(self, **kwargs: Any) -> None: self.identity_type: str = "UserIdentity" -class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionPropertiesV2): +class UsernamePasswordAuthTypeWorkspaceConnectionProperties( + WorkspaceConnectionPropertiesV2 +): # pylint: disable=too-many-instance-attributes,name-too-long """UsernamePasswordAuthTypeWorkspaceConnectionProperties. - All required parameters must be populated in order to send to Azure. + 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 server. :ivar auth_type: Authentication type of the connection target. Required. Known values are: - "PAT", "ManagedIdentity", "UsernamePassword", "None", and "SAS". + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". :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", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". :vartype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.machinelearningservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :ivar pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] :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 use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool :ivar credentials: :vartype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword @@ -21661,14 +33645,24 @@ class UsernamePasswordAuthTypeWorkspaceConnectionProperties(WorkspaceConnectionP _validation = { "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, } _attribute_map = { "auth_type": {"key": "authType", "type": "str"}, "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, "target": {"key": "target", "type": "str"}, - "value": {"key": "value", "type": "str"}, - "value_format": {"key": "valueFormat", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, "credentials": {"key": "credentials", "type": "WorkspaceConnectionUsernamePassword"}, } @@ -21676,27 +33670,74 @@ def __init__( self, *, category: Optional[Union[str, "_models.ConnectionCategory"]] = None, + error: Optional[str] = None, + expiry_time: Optional[datetime.datetime] = None, + is_shared_to_all: Optional[bool] = None, + metadata: Optional[Dict[str, str]] = None, + pe_requirement: Optional[Union[str, "_models.ManagedPERequirement"]] = None, + pe_status: Optional[Union[str, "_models.ManagedPEStatus"]] = None, + shared_user_list: Optional[List[str]] = None, target: Optional[str] = None, - value: Optional[str] = None, - value_format: Optional[Union[str, "_models.ValueFormat"]] = None, + use_workspace_managed_identity: Optional[bool] = None, credentials: Optional["_models.WorkspaceConnectionUsernamePassword"] = None, **kwargs: Any ) -> None: """ :keyword category: Category of the connection. Known values are: "PythonFeed", - "ContainerRegistry", and "Git". + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". :paramtype category: str or ~azure.mgmt.machinelearningservices.models.ConnectionCategory + :keyword error: + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Known values are: "Required", "NotRequired", and "NotApplicable". + :paramtype pe_requirement: str or + ~azure.mgmt.machinelearningservices.models.ManagedPERequirement + :keyword pe_status: Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.machinelearningservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] :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 use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool :keyword credentials: :paramtype credentials: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUsernamePassword """ - super().__init__(category=category, target=target, value=value, value_format=value_format, **kwargs) + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) self.auth_type: str = "UsernamePassword" self.credentials = credentials @@ -21727,7 +33768,7 @@ class VirtualMachine(Compute, VirtualMachineSchema): # pylint: disable=too-many 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. + All required parameters must be populated in order to send to server. :ivar properties: :vartype properties: ~azure.mgmt.machinelearningservices.models.VirtualMachineSchemaProperties @@ -21831,7 +33872,7 @@ def __init__( class VirtualMachineImage(_serialization.Model): """Virtual Machine image for Windows AML Compute. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Virtual Machine image path. Required. :vartype id: str @@ -21945,7 +33986,7 @@ def __init__( class VirtualMachineSecrets(ComputeSecrets, VirtualMachineSecretsSchema): """Secrets related to a Machine Learning compute based on AKS. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar administrator_account: Admin credentials for virtual machine. :vartype administrator_account: @@ -22130,7 +34171,7 @@ def __init__( class VolumeDefinition(_serialization.Model): - """Describes the volume configuration for the container. + """VolumeDefinition. :ivar type: Type of Volume Definition. Possible Values: bind,volume,tmpfs,npipe. Known values are: "bind", "volume", "tmpfs", and "npipe". @@ -22207,7 +34248,7 @@ def __init__( class VolumeOptions(_serialization.Model): - """Describes the volume options for the container. + """VolumeOptions. :ivar nocopy: Indicate whether volume is nocopy. :vartype nocopy: bool @@ -22232,7 +34273,7 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -22242,83 +34283,137 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.machinelearningservices.models.SystemData - :ivar identity: The identity of the resource. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :ivar location: Specifies the location of the resource. + :ivar kind: + :vartype kind: str + :ivar location: :vartype location: str - :ivar tags: Contains resource tags defined as key/value pairs. - :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar workspace_id: The immutable id associated with this workspace. - :vartype workspace_id: str - :ivar description: The description of this workspace. - :vartype description: str - :ivar friendly_name: The friendly name for this workspace. This name in mutable. - :vartype friendly_name: str - :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed - once the workspace has been created. - :vartype key_vault: str + :ivar tags: Dictionary of :code:``. + :vartype tags: dict[str, str] + :ivar agents_endpoint_uri: The URI of agents endpoint associated with this workspace. + :vartype agents_endpoint_uri: str + :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access + when behind VNet. + :vartype allow_public_access_when_behind_vnet: bool + :ivar allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment for + the workspace MSI on resource group level. + :vartype allow_role_assignment_on_rg: bool :ivar application_insights: ARM id of the application insights associated with this workspace. :vartype application_insights: str + :ivar associated_workspaces: + :vartype associated_workspaces: list[str] + :ivar container_registries: + :vartype container_registries: list[str] :ivar container_registry: ARM id of the container registry associated with this workspace. :vartype container_registry: str - :ivar storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :vartype storage_account: str + :ivar description: The description of this workspace. + :vartype description: str :ivar discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :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". - :vartype provisioning_state: str or - ~azure.mgmt.machinelearningservices.models.ProvisioningState - :ivar encryption: The encryption settings of Azure ML workspace. + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_service_side_cmk_encryption: + :vartype enable_service_side_cmk_encryption: bool + :ivar enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :vartype enable_simplified_cmk: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :ivar existing_workspaces: + :vartype existing_workspaces: list[str] + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. + :vartype friendly_name: str :ivar hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service. :vartype hbi_workspace: bool - :ivar service_provisioned_resource_group: The name of the managed resource group created by - workspace RP in customer subscription if the workspace is CMK workspace. - :vartype service_provisioned_resource_group: str - :ivar private_link_count: Count of private connections in the workspace. - :vartype private_link_count: int + :ivar hub_resource_id: + :vartype hub_resource_id: str :ivar image_build_compute: The compute name for image build. :vartype image_build_compute: str - :ivar allow_public_access_when_behind_vnet: The flag to indicate whether to allow public access - when behind VNet. - :vartype allow_public_access_when_behind_vnet: bool - :ivar public_network_access: Whether requests from Public Network are allowed. Known values - are: "Enabled" and "Disabled". - :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar key_vault: ARM id of the key vault associated with this workspace. This cannot be changed + once the workspace has been created. + :vartype key_vault: str + :ivar key_vaults: + :vartype key_vaults: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow + must point at to set up tracking. + :vartype ml_flow_tracking_uri: str + :ivar network_acls: A set of rules governing the network accessibility of the workspace. + :vartype network_acls: ~azure.mgmt.machinelearningservices.models.NetworkAcls + :ivar notebook_info: The notebook info of Azure ML workspace. + :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo + :ivar primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :vartype primary_user_assigned_identity: str :ivar private_endpoint_connections: The list of private endpoint connections in the workspace. :vartype private_endpoint_connections: list[~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection] + :ivar private_link_count: Count of private connections in the workspace. + :vartype private_link_count: int + :ivar provision_network_now: Set to trigger the provisioning of the managed VNet with the + default Options when creating a Workspace with the managed VNet enabled, or else it does + nothing. + :vartype provision_network_now: bool + :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". + :vartype provisioning_state: str or + ~azure.mgmt.machinelearningservices.models.ProvisioningState + :ivar public_network_access: Whether requests from Public Network are allowed. Known values + are: "Enabled" and "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. + :vartype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar service_provisioned_resource_group: The name of the managed resource group created by + workspace RP in customer subscription if the workspace is CMK workspace. + :vartype service_provisioned_resource_group: str :ivar shared_private_link_resources: The list of shared private link resources in this workspace. :vartype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :ivar notebook_info: The notebook info of Azure ML workspace. - :vartype notebook_info: ~azure.mgmt.machinelearningservices.models.NotebookResourceInfo - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :ivar primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :vartype primary_user_assigned_identity: str - :ivar tenant_id: The tenant id associated with this workspace. - :vartype tenant_id: str + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int + :ivar storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :vartype storage_account: str + :ivar storage_accounts: + :vartype storage_accounts: list[str] :ivar storage_hns_enabled: If the storage associated with the workspace has hierarchical namespace(HNS) enabled. :vartype storage_hns_enabled: bool - :ivar ml_flow_tracking_uri: The URI associated with this workspace that machine learning flow - must point at to set up tracking. - :vartype ml_flow_tracking_uri: str + :ivar system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. Known values are: "AccessKey", "Identity", and "UserDelegationSAS". + :vartype system_datastores_auth_mode: str or + ~azure.mgmt.machinelearningservices.models.SystemDatastoresAuthMode + :ivar tenant_id: The tenant id associated with this workspace. + :vartype tenant_id: str :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 workspace_hub_config: WorkspaceHub's configuration object. + :vartype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig + :ivar workspace_id: The immutable id associated with this workspace. + :vartype workspace_id: str """ _validation = { @@ -22326,15 +34421,16 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes "name": {"readonly": True}, "type": {"readonly": True}, "system_data": {"readonly": True}, - "workspace_id": {"readonly": True}, + "agents_endpoint_uri": {"readonly": True}, + "ml_flow_tracking_uri": {"readonly": True}, + "notebook_info": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + "private_link_count": {"readonly": True}, "provisioning_state": {"readonly": True}, "service_provisioned_resource_group": {"readonly": True}, - "private_link_count": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - "notebook_info": {"readonly": True}, - "tenant_id": {"readonly": True}, "storage_hns_enabled": {"readonly": True}, - "ml_flow_tracking_uri": {"readonly": True}, + "tenant_id": {"readonly": True}, + "workspace_id": {"readonly": True}, } _attribute_map = { @@ -22343,181 +34439,451 @@ class Workspace(Resource): # pylint: disable=too-many-instance-attributes "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "kind": {"key": "kind", "type": "str"}, "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, "sku": {"key": "sku", "type": "Sku"}, - "workspace_id": {"key": "properties.workspaceId", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "friendly_name": {"key": "properties.friendlyName", "type": "str"}, - "key_vault": {"key": "properties.keyVault", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "agents_endpoint_uri": {"key": "properties.agentsEndpointUri", "type": "str"}, + "allow_public_access_when_behind_vnet": {"key": "properties.allowPublicAccessWhenBehindVnet", "type": "bool"}, + "allow_role_assignment_on_rg": {"key": "properties.allowRoleAssignmentOnRG", "type": "bool"}, "application_insights": {"key": "properties.applicationInsights", "type": "str"}, + "associated_workspaces": {"key": "properties.associatedWorkspaces", "type": "[str]"}, + "container_registries": {"key": "properties.containerRegistries", "type": "[str]"}, "container_registry": {"key": "properties.containerRegistry", "type": "str"}, - "storage_account": {"key": "properties.storageAccount", "type": "str"}, + "description": {"key": "properties.description", "type": "str"}, "discovery_url": {"key": "properties.discoveryUrl", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "enable_data_isolation": {"key": "properties.enableDataIsolation", "type": "bool"}, + "enable_service_side_cmk_encryption": {"key": "properties.enableServiceSideCMKEncryption", "type": "bool"}, + "enable_simplified_cmk": {"key": "properties.enableSimplifiedCmk", "type": "bool"}, + "enable_software_bill_of_materials": {"key": "properties.enableSoftwareBillOfMaterials", "type": "bool"}, "encryption": {"key": "properties.encryption", "type": "EncryptionProperty"}, + "existing_workspaces": {"key": "properties.existingWorkspaces", "type": "[str]"}, + "feature_store_settings": {"key": "properties.featureStoreSettings", "type": "FeatureStoreSettings"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "hbi_workspace": {"key": "properties.hbiWorkspace", "type": "bool"}, - "service_provisioned_resource_group": {"key": "properties.serviceProvisionedResourceGroup", "type": "str"}, - "private_link_count": {"key": "properties.privateLinkCount", "type": "int"}, + "hub_resource_id": {"key": "properties.hubResourceId", "type": "str"}, "image_build_compute": {"key": "properties.imageBuildCompute", "type": "str"}, - "allow_public_access_when_behind_vnet": {"key": "properties.allowPublicAccessWhenBehindVnet", "type": "bool"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "ip_allowlist": {"key": "properties.ipAllowlist", "type": "[str]"}, + "key_vault": {"key": "properties.keyVault", "type": "str"}, + "key_vaults": {"key": "properties.keyVaults", "type": "[str]"}, + "managed_network": {"key": "properties.managedNetwork", "type": "ManagedNetworkSettings"}, + "ml_flow_tracking_uri": {"key": "properties.mlFlowTrackingUri", "type": "str"}, + "network_acls": {"key": "properties.networkAcls", "type": "NetworkAcls"}, + "notebook_info": {"key": "properties.notebookInfo", "type": "NotebookResourceInfo"}, + "primary_user_assigned_identity": {"key": "properties.primaryUserAssignedIdentity", "type": "str"}, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, - "shared_private_link_resources": { - "key": "properties.sharedPrivateLinkResources", - "type": "[SharedPrivateLinkResource]", + "private_link_count": {"key": "properties.privateLinkCount", "type": "int"}, + "provision_network_now": {"key": "properties.provisionNetworkNow", "type": "bool"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "serverless_compute_settings": { + "key": "properties.serverlessComputeSettings", + "type": "ServerlessComputeSettings", }, - "notebook_info": {"key": "properties.notebookInfo", "type": "NotebookResourceInfo"}, "service_managed_resources_settings": { "key": "properties.serviceManagedResourcesSettings", "type": "ServiceManagedResourcesSettings", }, - "primary_user_assigned_identity": {"key": "properties.primaryUserAssignedIdentity", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, + "service_provisioned_resource_group": {"key": "properties.serviceProvisionedResourceGroup", "type": "str"}, + "shared_private_link_resources": { + "key": "properties.sharedPrivateLinkResources", + "type": "[SharedPrivateLinkResource]", + }, + "soft_delete_retention_in_days": {"key": "properties.softDeleteRetentionInDays", "type": "int"}, + "storage_account": {"key": "properties.storageAccount", "type": "str"}, + "storage_accounts": {"key": "properties.storageAccounts", "type": "[str]"}, "storage_hns_enabled": {"key": "properties.storageHnsEnabled", "type": "bool"}, - "ml_flow_tracking_uri": {"key": "properties.mlFlowTrackingUri", "type": "str"}, + "system_datastores_auth_mode": {"key": "properties.systemDatastoresAuthMode", "type": "str"}, + "tenant_id": {"key": "properties.tenantId", "type": "str"}, "v1_legacy_mode": {"key": "properties.v1LegacyMode", "type": "bool"}, + "workspace_hub_config": {"key": "properties.workspaceHubConfig", "type": "WorkspaceHubConfig"}, + "workspace_id": {"key": "properties.workspaceId", "type": "str"}, } def __init__( # pylint: disable=too-many-locals self, *, identity: Optional["_models.ManagedServiceIdentity"] = None, + kind: Optional[str] = None, location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, sku: Optional["_models.Sku"] = None, - description: Optional[str] = None, - friendly_name: Optional[str] = None, - key_vault: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + allow_public_access_when_behind_vnet: Optional[bool] = None, + allow_role_assignment_on_rg: Optional[bool] = None, application_insights: Optional[str] = None, + associated_workspaces: Optional[List[str]] = None, + container_registries: Optional[List[str]] = None, container_registry: Optional[str] = None, - storage_account: Optional[str] = None, + description: Optional[str] = None, discovery_url: Optional[str] = None, + enable_data_isolation: Optional[bool] = None, + enable_service_side_cmk_encryption: Optional[bool] = None, + enable_simplified_cmk: Optional[bool] = None, + enable_software_bill_of_materials: Optional[bool] = None, encryption: Optional["_models.EncryptionProperty"] = None, - hbi_workspace: bool = False, + existing_workspaces: Optional[List[str]] = None, + feature_store_settings: Optional["_models.FeatureStoreSettings"] = None, + friendly_name: Optional[str] = None, + hbi_workspace: Optional[bool] = None, + hub_resource_id: Optional[str] = None, image_build_compute: Optional[str] = None, - allow_public_access_when_behind_vnet: bool = False, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - shared_private_link_resources: Optional[List["_models.SharedPrivateLinkResource"]] = None, - service_managed_resources_settings: Optional["_models.ServiceManagedResourcesSettings"] = None, + ip_allowlist: Optional[List[str]] = None, + key_vault: Optional[str] = None, + key_vaults: Optional[List[str]] = None, + managed_network: Optional["_models.ManagedNetworkSettings"] = None, + network_acls: Optional["_models.NetworkAcls"] = None, primary_user_assigned_identity: Optional[str] = None, - v1_legacy_mode: bool = False, + provision_network_now: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + serverless_compute_settings: Optional["_models.ServerlessComputeSettings"] = None, + service_managed_resources_settings: Optional["_models.ServiceManagedResourcesSettings"] = None, + shared_private_link_resources: Optional[List["_models.SharedPrivateLinkResource"]] = None, + soft_delete_retention_in_days: Optional[int] = None, + storage_account: Optional[str] = None, + storage_accounts: Optional[List[str]] = None, + system_datastores_auth_mode: Optional[Union[str, "_models.SystemDatastoresAuthMode"]] = None, + v1_legacy_mode: Optional[bool] = None, + workspace_hub_config: Optional["_models.WorkspaceHubConfig"] = None, **kwargs: Any ) -> None: """ - :keyword identity: The identity of the resource. + :keyword identity: Managed service identity (system assigned and/or user assigned identities). :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity - :keyword location: Specifies the location of the resource. + :keyword kind: + :paramtype kind: str + :keyword location: :paramtype location: str - :keyword tags: Contains resource tags defined as key/value pairs. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword description: The description of this workspace. - :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. This name in mutable. - :paramtype friendly_name: str - :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be - changed once the workspace has been created. - :paramtype key_vault: str + :keyword tags: Dictionary of :code:``. + :paramtype tags: dict[str, str] + :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public + access when behind VNet. + :paramtype allow_public_access_when_behind_vnet: bool + :keyword allow_role_assignment_on_rg: The flag to indicate whether we will do role assignment + for the workspace MSI on resource group level. + :paramtype allow_role_assignment_on_rg: bool :keyword application_insights: ARM id of the application insights associated with this workspace. :paramtype application_insights: str + :keyword associated_workspaces: + :paramtype associated_workspaces: list[str] + :keyword container_registries: + :paramtype container_registries: list[str] :keyword container_registry: ARM id of the container registry associated with this workspace. :paramtype container_registry: str - :keyword storage_account: ARM id of the storage account associated with this workspace. This - cannot be changed once the workspace has been created. - :paramtype storage_account: str + :keyword description: The description of this workspace. + :paramtype description: str :keyword discovery_url: Url for the discovery service to identify regional endpoints for machine learning experimentation services. :paramtype discovery_url: str - :keyword encryption: The encryption settings of Azure ML workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_service_side_cmk_encryption: + :paramtype enable_service_side_cmk_encryption: bool + :keyword enable_simplified_cmk: Flag to tell if simplified CMK should be enabled for this + workspace. + :paramtype enable_simplified_cmk: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionProperty + :keyword existing_workspaces: + :paramtype existing_workspaces: list[str] + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. + :paramtype friendly_name: str :keyword hbi_workspace: The flag to signal HBI data in the workspace and reduce diagnostic data collected by the service. :paramtype hbi_workspace: bool + :keyword hub_resource_id: + :paramtype hub_resource_id: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword allow_public_access_when_behind_vnet: The flag to indicate whether to allow public - access when behind VNet. - :paramtype allow_public_access_when_behind_vnet: bool + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword key_vault: ARM id of the key vault associated with this workspace. This cannot be + changed once the workspace has been created. + :paramtype key_vault: str + :keyword key_vaults: + :paramtype key_vaults: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :keyword network_acls: A set of rules governing the network accessibility of the workspace. + :paramtype network_acls: ~azure.mgmt.machinelearningservices.models.NetworkAcls + :keyword primary_user_assigned_identity: The user assigned identity resource id that represents + the workspace identity. + :paramtype primary_user_assigned_identity: str + :keyword provision_network_now: Set to trigger the provisioning of the managed VNet with the + default Options when creating a Workspace with the managed VNet enabled, or else it does + nothing. + :paramtype provision_network_now: bool :keyword public_network_access: Whether requests from Public Network are allowed. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. + :paramtype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings :keyword shared_private_link_resources: The list of shared private link resources in this workspace. :paramtype shared_private_link_resources: list[~azure.mgmt.machinelearningservices.models.SharedPrivateLinkResource] - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings - :keyword primary_user_assigned_identity: The user assigned identity resource id that represents - the workspace identity. - :paramtype primary_user_assigned_identity: str + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int + :keyword storage_account: ARM id of the storage account associated with this workspace. This + cannot be changed once the workspace has been created. + :paramtype storage_account: str + :keyword storage_accounts: + :paramtype storage_accounts: list[str] + :keyword system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. Known values are: "AccessKey", "Identity", and "UserDelegationSAS". + :paramtype system_datastores_auth_mode: str or + ~azure.mgmt.machinelearningservices.models.SystemDatastoresAuthMode :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 workspace_hub_config: WorkspaceHub's configuration object. + :paramtype workspace_hub_config: ~azure.mgmt.machinelearningservices.models.WorkspaceHubConfig """ super().__init__(**kwargs) self.identity = identity + self.kind = kind self.location = location - self.tags = tags self.sku = sku - self.workspace_id = None - self.description = description - self.friendly_name = friendly_name - self.key_vault = key_vault + self.tags = tags + self.agents_endpoint_uri = None + self.allow_public_access_when_behind_vnet = allow_public_access_when_behind_vnet + self.allow_role_assignment_on_rg = allow_role_assignment_on_rg self.application_insights = application_insights + self.associated_workspaces = associated_workspaces + self.container_registries = container_registries self.container_registry = container_registry - self.storage_account = storage_account + self.description = description self.discovery_url = discovery_url - self.provisioning_state = None + self.enable_data_isolation = enable_data_isolation + self.enable_service_side_cmk_encryption = enable_service_side_cmk_encryption + self.enable_simplified_cmk = enable_simplified_cmk + self.enable_software_bill_of_materials = enable_software_bill_of_materials self.encryption = encryption + self.existing_workspaces = existing_workspaces + self.feature_store_settings = feature_store_settings + self.friendly_name = friendly_name self.hbi_workspace = hbi_workspace - self.service_provisioned_resource_group = None - self.private_link_count = None + self.hub_resource_id = hub_resource_id self.image_build_compute = image_build_compute - self.allow_public_access_when_behind_vnet = allow_public_access_when_behind_vnet - self.public_network_access = public_network_access - self.private_endpoint_connections = None - self.shared_private_link_resources = shared_private_link_resources + self.ip_allowlist = ip_allowlist + self.key_vault = key_vault + self.key_vaults = key_vaults + self.managed_network = managed_network + self.ml_flow_tracking_uri = None + self.network_acls = network_acls self.notebook_info = None - self.service_managed_resources_settings = service_managed_resources_settings self.primary_user_assigned_identity = primary_user_assigned_identity - self.tenant_id = None + self.private_endpoint_connections = None + self.private_link_count = None + self.provision_network_now = provision_network_now + self.provisioning_state = None + self.public_network_access = public_network_access + self.serverless_compute_settings = serverless_compute_settings + self.service_managed_resources_settings = service_managed_resources_settings + self.service_provisioned_resource_group = None + self.shared_private_link_resources = shared_private_link_resources + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.storage_account = storage_account + self.storage_accounts = storage_accounts self.storage_hns_enabled = None - self.ml_flow_tracking_uri = None + self.system_datastores_auth_mode = system_datastores_auth_mode + self.tenant_id = None self.v1_legacy_mode = v1_legacy_mode + self.workspace_hub_config = workspace_hub_config + self.workspace_id = None + + +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: Any + ) -> None: + """ + :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 WorkspaceConnectionAccountKey(_serialization.Model): + """Account key object for workspace connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key + + +class WorkspaceConnectionApiKey(_serialization.Model): + """Api key object for workspace connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key class WorkspaceConnectionManagedIdentity(_serialization.Model): """WorkspaceConnectionManagedIdentity. + :ivar client_id: + :vartype client_id: str :ivar resource_id: :vartype resource_id: str - :ivar client_id: + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, client_id: Optional[str] = None, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: + :paramtype client_id: str + :keyword resource_id: + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.resource_id = resource_id + + +class WorkspaceConnectionOAuth2(_serialization.Model): + """ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + + :ivar auth_url: Required by Concur connection category. + :vartype auth_url: str + :ivar client_id: Client id in the format of UUID. :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar developer_token: Required by GoogleAdWords connection category. + :vartype developer_token: str + :ivar password: + :vartype password: str + :ivar refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :vartype refresh_token: str + :ivar tenant_id: Required by QuickBooks and Xero connection categories. + :vartype tenant_id: str + :ivar username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :vartype username: str """ _attribute_map = { - "resource_id": {"key": "resourceId", "type": "str"}, + "auth_url": {"key": "authUrl", "type": "str"}, "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "developer_token": {"key": "developerToken", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "refresh_token": {"key": "refreshToken", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "username": {"key": "username", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, client_id: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + auth_url: Optional[str] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + developer_token: Optional[str] = None, + password: Optional[str] = None, + refresh_token: Optional[str] = None, + tenant_id: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword resource_id: - :paramtype resource_id: str - :keyword client_id: + :keyword auth_url: Required by Concur connection category. + :paramtype auth_url: str + :keyword client_id: Client id in the format of UUID. :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword developer_token: Required by GoogleAdWords connection category. + :paramtype developer_token: str + :keyword password: + :paramtype password: str + :keyword refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :paramtype refresh_token: str + :keyword tenant_id: Required by QuickBooks and Xero connection categories. + :paramtype tenant_id: str + :keyword username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :paramtype username: str """ super().__init__(**kwargs) - self.resource_id = resource_id + self.auth_url = auth_url self.client_id = client_id + self.client_secret = client_secret + self.developer_token = developer_token + self.password = password + self.refresh_token = refresh_token + self.tenant_id = tenant_id + self.username = username class WorkspaceConnectionPersonalAccessToken(_serialization.Model): @@ -22540,15 +34906,15 @@ def __init__(self, *, pat: Optional[str] = None, **kwargs: Any) -> None: self.pat = pat -class WorkspaceConnectionPropertiesV2BasicResource(Resource): +class WorkspaceConnectionPropertiesV2BasicResource(Resource): # pylint: disable=name-too-long """WorkspaceConnectionPropertiesV2BasicResource. 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. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -22588,38 +34954,79 @@ def __init__(self, *, properties: "_models.WorkspaceConnectionPropertiesV2", **k self.properties = properties -class WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult(_serialization.Model): +class WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult( + _serialization.Model +): # pylint: disable=name-too-long """WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult. - Variables are only populated by the server, and will be ignored when sending a request. - + :ivar next_link: + :vartype next_link: str :ivar value: :vartype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] - :ivar next_link: - :vartype next_link: str """ - _validation = { - "next_link": {"readonly": True}, - } - _attribute_map = { - "value": {"key": "value", "type": "[WorkspaceConnectionPropertiesV2BasicResource]"}, "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[WorkspaceConnectionPropertiesV2BasicResource]"}, } def __init__( - self, *, value: Optional[List["_models.WorkspaceConnectionPropertiesV2BasicResource"]] = None, **kwargs: Any + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.WorkspaceConnectionPropertiesV2BasicResource"]] = None, + **kwargs: Any ) -> None: """ + :keyword next_link: + :paramtype next_link: str :keyword value: :paramtype value: list[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] """ super().__init__(**kwargs) + self.next_link = next_link self.value = value - 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: Any + ) -> None: + """ + :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): @@ -22642,166 +35049,369 @@ def __init__(self, *, sas: Optional[str] = None, **kwargs: Any) -> None: self.sas = sas +class WorkspaceConnectionUpdateParameter(_serialization.Model): + """The properties that the machine learning workspace connection will be updated with. + + :ivar properties: The properties that the machine learning workspace connection will be updated + with. + :vartype properties: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + + _attribute_map = { + "properties": {"key": "properties", "type": "WorkspaceConnectionPropertiesV2"}, + } + + def __init__( + self, *, properties: Optional["_models.WorkspaceConnectionPropertiesV2"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: The properties that the machine learning workspace connection will be + updated with. + :paramtype properties: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2 + """ + super().__init__(**kwargs) + self.properties = properties + + class WorkspaceConnectionUsernamePassword(_serialization.Model): """WorkspaceConnectionUsernamePassword. - :ivar username: - :vartype username: str :ivar password: :vartype password: str + :ivar security_token: Optional, required by connections like SalesForce for extra security in + addition to UsernamePassword. + :vartype security_token: str + :ivar username: + :vartype username: str """ _attribute_map = { - "username": {"key": "username", "type": "str"}, "password": {"key": "password", "type": "str"}, + "security_token": {"key": "securityToken", "type": "str"}, + "username": {"key": "username", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + password: Optional[str] = None, + security_token: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword username: - :paramtype username: str :keyword password: :paramtype password: str + :keyword security_token: Optional, required by connections like SalesForce for extra security + in addition to UsernamePassword. + :paramtype security_token: str + :keyword username: + :paramtype username: str """ super().__init__(**kwargs) - self.username = username self.password = password + self.security_token = security_token + self.username = username + + +class WorkspaceHubConfig(_serialization.Model): + """WorkspaceHub's configuration object. + + :ivar additional_workspace_storage_accounts: + :vartype additional_workspace_storage_accounts: list[str] + :ivar default_workspace_resource_group: + :vartype default_workspace_resource_group: str + """ + + _attribute_map = { + "additional_workspace_storage_accounts": {"key": "additionalWorkspaceStorageAccounts", "type": "[str]"}, + "default_workspace_resource_group": {"key": "defaultWorkspaceResourceGroup", "type": "str"}, + } + + def __init__( + self, + *, + additional_workspace_storage_accounts: Optional[List[str]] = None, + default_workspace_resource_group: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword additional_workspace_storage_accounts: + :paramtype additional_workspace_storage_accounts: list[str] + :keyword default_workspace_resource_group: + :paramtype default_workspace_resource_group: str + """ + super().__init__(**kwargs) + self.additional_workspace_storage_accounts = additional_workspace_storage_accounts + self.default_workspace_resource_group = default_workspace_resource_group class WorkspaceListResult(_serialization.Model): """The result of a request to list machine learning workspaces. + :ivar next_link: The link to the next page constructed using the continuationToken. If null, + there are no additional pages. + :vartype next_link: str :ivar value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :vartype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :ivar next_link: The URI that can be used to request the next list of machine learning - workspaces. - :vartype next_link: str """ _attribute_map = { - "value": {"key": "value", "type": "[Workspace]"}, "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Workspace]"}, } def __init__( - self, *, value: Optional[List["_models.Workspace"]] = None, next_link: Optional[str] = None, **kwargs: Any + self, *, next_link: Optional[str] = None, value: Optional[List["_models.Workspace"]] = None, **kwargs: Any ) -> None: """ + :keyword next_link: The link to the next page constructed using the continuationToken. If + null, there are no additional pages. + :paramtype next_link: str :keyword value: The list of machine learning workspaces. Since this list may be incomplete, the nextLink field should be used to request the next list of machine learning workspaces. :paramtype value: list[~azure.mgmt.machinelearningservices.models.Workspace] - :keyword next_link: The URI that can be used to request the next list of machine learning - workspaces. - :paramtype next_link: str """ super().__init__(**kwargs) - self.value = value self.next_link = next_link + self.value = value + + +class WorkspacePrivateEndpointResource(_serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: e.g. + /subscriptions/{networkSubscriptionId}/resourceGroups/{rgName}/providers/Microsoft.Network/privateEndpoints/{privateEndpointName}. # pylint: disable=line-too-long + :vartype id: str + :ivar subnet_arm_id: The subnetId that the private endpoint is connected to. + :vartype subnet_arm_id: str + """ + + _validation = { + "id": {"readonly": True}, + "subnet_arm_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.subnet_arm_id = None class WorkspaceUpdateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """The parameters for updating a machine learning workspace. + :ivar identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku :ivar tags: The resource tags for the machine learning workspace. :vartype tags: dict[str, str] - :ivar sku: The sku of the workspace. - :vartype sku: ~azure.mgmt.machinelearningservices.models.Sku - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :ivar allow_role_assignment_on_rg: + :vartype allow_role_assignment_on_rg: bool + :ivar application_insights: ARM id of the application insights associated with this workspace. + :vartype application_insights: str + :ivar container_registry: ARM id of the container registry associated with this workspace. + :vartype container_registry: str :ivar description: The description of this workspace. :vartype description: str - :ivar friendly_name: The friendly name for this workspace. + :ivar enable_data_isolation: + :vartype enable_data_isolation: bool + :ivar enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :vartype enable_software_bill_of_materials: bool + :ivar encryption: + :vartype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :ivar feature_store_settings: Settings for feature store type workspace. + :vartype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :ivar friendly_name: The friendly name for this workspace. This name in mutable. :vartype friendly_name: str :ivar image_build_compute: The compute name for image build. :vartype image_build_compute: str - :ivar service_managed_resources_settings: The service managed resource settings. - :vartype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :vartype ip_allowlist: list[str] + :ivar managed_network: Managed Network settings for a machine learning workspace. + :vartype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :ivar network_acls: A set of rules governing the network accessibility of the workspace. + :vartype network_acls: ~azure.mgmt.machinelearningservices.models.NetworkAcls :ivar primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :vartype primary_user_assigned_identity: str :ivar public_network_access: Whether requests from Public Network are allowed. Known values are: "Enabled" and "Disabled". :vartype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :ivar application_insights: ARM id of the application insights associated with this workspace. - :vartype application_insights: str - :ivar container_registry: ARM id of the container registry associated with this workspace. - :vartype container_registry: str + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :ivar serverless_compute_settings: Settings for serverless compute in a workspace. + :vartype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :ivar service_managed_resources_settings: The service managed resource settings. + :vartype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :ivar soft_delete_retention_in_days: Retention time in days after workspace get soft deleted. + :vartype soft_delete_retention_in_days: int + :ivar system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. Known values are: "AccessKey", "Identity", and "UserDelegationSAS". + :vartype system_datastores_auth_mode: str or + ~azure.mgmt.machinelearningservices.models.SystemDatastoresAuthMode + :ivar v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided by + the v2 API. + :vartype v1_legacy_mode: bool """ _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "tags": {"key": "tags", "type": "{str}"}, + "allow_role_assignment_on_rg": {"key": "properties.allowRoleAssignmentOnRG", "type": "bool"}, + "application_insights": {"key": "properties.applicationInsights", "type": "str"}, + "container_registry": {"key": "properties.containerRegistry", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, + "enable_data_isolation": {"key": "properties.enableDataIsolation", "type": "bool"}, + "enable_software_bill_of_materials": {"key": "properties.enableSoftwareBillOfMaterials", "type": "bool"}, + "encryption": {"key": "properties.encryption", "type": "EncryptionUpdateProperties"}, + "feature_store_settings": {"key": "properties.featureStoreSettings", "type": "FeatureStoreSettings"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "image_build_compute": {"key": "properties.imageBuildCompute", "type": "str"}, + "ip_allowlist": {"key": "properties.ipAllowlist", "type": "[str]"}, + "managed_network": {"key": "properties.managedNetwork", "type": "ManagedNetworkSettings"}, + "network_acls": {"key": "properties.networkAcls", "type": "NetworkAcls"}, + "primary_user_assigned_identity": {"key": "properties.primaryUserAssignedIdentity", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "serverless_compute_settings": { + "key": "properties.serverlessComputeSettings", + "type": "ServerlessComputeSettings", + }, "service_managed_resources_settings": { "key": "properties.serviceManagedResourcesSettings", "type": "ServiceManagedResourcesSettings", }, - "primary_user_assigned_identity": {"key": "properties.primaryUserAssignedIdentity", "type": "str"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "application_insights": {"key": "properties.applicationInsights", "type": "str"}, - "container_registry": {"key": "properties.containerRegistry", "type": "str"}, + "soft_delete_retention_in_days": {"key": "properties.softDeleteRetentionInDays", "type": "int"}, + "system_datastores_auth_mode": {"key": "properties.systemDatastoresAuthMode", "type": "str"}, + "v1_legacy_mode": {"key": "properties.v1LegacyMode", "type": "bool"}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + tags: Optional[Dict[str, str]] = None, + allow_role_assignment_on_rg: Optional[bool] = None, + application_insights: Optional[str] = None, + container_registry: Optional[str] = None, description: Optional[str] = None, + enable_data_isolation: Optional[bool] = None, + enable_software_bill_of_materials: Optional[bool] = None, + encryption: Optional["_models.EncryptionUpdateProperties"] = None, + feature_store_settings: Optional["_models.FeatureStoreSettings"] = None, friendly_name: Optional[str] = None, image_build_compute: Optional[str] = None, - service_managed_resources_settings: Optional["_models.ServiceManagedResourcesSettings"] = None, + ip_allowlist: Optional[List[str]] = None, + managed_network: Optional["_models.ManagedNetworkSettings"] = None, + network_acls: Optional["_models.NetworkAcls"] = None, primary_user_assigned_identity: Optional[str] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - application_insights: Optional[str] = None, - container_registry: Optional[str] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + serverless_compute_settings: Optional["_models.ServerlessComputeSettings"] = None, + service_managed_resources_settings: Optional["_models.ServiceManagedResourcesSettings"] = None, + soft_delete_retention_in_days: Optional[int] = None, + system_datastores_auth_mode: Optional[Union[str, "_models.SystemDatastoresAuthMode"]] = None, + v1_legacy_mode: Optional[bool] = None, **kwargs: Any ) -> None: """ + :keyword identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword sku: Optional. This field is required to be implemented by the RP because AML is + supporting more than one tier. + :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku :keyword tags: The resource tags for the machine learning workspace. :paramtype tags: dict[str, str] - :keyword sku: The sku of the workspace. - :paramtype sku: ~azure.mgmt.machinelearningservices.models.Sku - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.machinelearningservices.models.ManagedServiceIdentity + :keyword allow_role_assignment_on_rg: + :paramtype allow_role_assignment_on_rg: bool + :keyword application_insights: ARM id of the application insights associated with this + workspace. + :paramtype application_insights: str + :keyword container_registry: ARM id of the container registry associated with this workspace. + :paramtype container_registry: str :keyword description: The description of this workspace. :paramtype description: str - :keyword friendly_name: The friendly name for this workspace. + :keyword enable_data_isolation: + :paramtype enable_data_isolation: bool + :keyword enable_software_bill_of_materials: Flag to tell if SoftwareBillOfMaterials should be + enabled for this workspace. + :paramtype enable_software_bill_of_materials: bool + :keyword encryption: + :paramtype encryption: ~azure.mgmt.machinelearningservices.models.EncryptionUpdateProperties + :keyword feature_store_settings: Settings for feature store type workspace. + :paramtype feature_store_settings: + ~azure.mgmt.machinelearningservices.models.FeatureStoreSettings + :keyword friendly_name: The friendly name for this workspace. This name in mutable. :paramtype friendly_name: str :keyword image_build_compute: The compute name for image build. :paramtype image_build_compute: str - :keyword service_managed_resources_settings: The service managed resource settings. - :paramtype service_managed_resources_settings: - ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword ip_allowlist: The list of IPv4 addresses that are allowed to access the workspace. + :paramtype ip_allowlist: list[str] + :keyword managed_network: Managed Network settings for a machine learning workspace. + :paramtype managed_network: ~azure.mgmt.machinelearningservices.models.ManagedNetworkSettings + :keyword network_acls: A set of rules governing the network accessibility of the workspace. + :paramtype network_acls: ~azure.mgmt.machinelearningservices.models.NetworkAcls :keyword primary_user_assigned_identity: The user assigned identity resource id that represents the workspace identity. :paramtype primary_user_assigned_identity: str :keyword public_network_access: Whether requests from Public Network are allowed. Known values are: "Enabled" and "Disabled". :paramtype public_network_access: str or - ~azure.mgmt.machinelearningservices.models.PublicNetworkAccess - :keyword application_insights: ARM id of the application insights associated with this - workspace. - :paramtype application_insights: str - :keyword container_registry: ARM id of the container registry associated with this workspace. - :paramtype container_registry: str + ~azure.mgmt.machinelearningservices.models.PublicNetworkAccessType + :keyword serverless_compute_settings: Settings for serverless compute in a workspace. + :paramtype serverless_compute_settings: + ~azure.mgmt.machinelearningservices.models.ServerlessComputeSettings + :keyword service_managed_resources_settings: The service managed resource settings. + :paramtype service_managed_resources_settings: + ~azure.mgmt.machinelearningservices.models.ServiceManagedResourcesSettings + :keyword soft_delete_retention_in_days: Retention time in days after workspace get soft + deleted. + :paramtype soft_delete_retention_in_days: int + :keyword system_datastores_auth_mode: The auth mode used for accessing the system datastores of + the workspace. Known values are: "AccessKey", "Identity", and "UserDelegationSAS". + :paramtype system_datastores_auth_mode: str or + ~azure.mgmt.machinelearningservices.models.SystemDatastoresAuthMode + :keyword v1_legacy_mode: Enabling v1_legacy_mode may prevent you from using features provided + by the v2 API. + :paramtype v1_legacy_mode: bool """ super().__init__(**kwargs) - self.tags = tags - self.sku = sku self.identity = identity + self.sku = sku + self.tags = tags + self.allow_role_assignment_on_rg = allow_role_assignment_on_rg + self.application_insights = application_insights + self.container_registry = container_registry self.description = description + self.enable_data_isolation = enable_data_isolation + self.enable_software_bill_of_materials = enable_software_bill_of_materials + self.encryption = encryption + self.feature_store_settings = feature_store_settings self.friendly_name = friendly_name self.image_build_compute = image_build_compute - self.service_managed_resources_settings = service_managed_resources_settings + self.ip_allowlist = ip_allowlist + self.managed_network = managed_network + self.network_acls = network_acls self.primary_user_assigned_identity = primary_user_assigned_identity self.public_network_access = public_network_access - self.application_insights = application_insights - self.container_registry = container_registry + self.serverless_compute_settings = serverless_compute_settings + self.service_managed_resources_settings = service_managed_resources_settings + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.system_datastores_auth_mode = system_datastores_auth_mode + self.v1_legacy_mode = v1_legacy_mode 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 4967e3af693..0137d6511d4 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 @@ -6,27 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._operations import Operations -from ._workspaces_operations import WorkspacesOperations from ._usages_operations import UsagesOperations from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations from ._quotas_operations import QuotasOperations from ._compute_operations import ComputeOperations -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_data_containers_operations import RegistryDataContainersOperations from ._registry_data_versions_operations import RegistryDataVersionsOperations +from ._registry_data_references_operations import RegistryDataReferencesOperations 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 ._capability_hosts_operations import CapabilityHostsOperations from ._code_containers_operations import CodeContainersOperations from ._code_versions_operations import CodeVersionsOperations from ._component_containers_operations import ComponentContainersOperations @@ -36,41 +33,66 @@ from ._datastores_operations import DatastoresOperations from ._environment_containers_operations import EnvironmentContainersOperations from ._environment_versions_operations import EnvironmentVersionsOperations +from ._featureset_containers_operations import FeaturesetContainersOperations +from ._features_operations import FeaturesOperations +from ._featureset_versions_operations import FeaturesetVersionsOperations +from ._featurestore_entity_containers_operations import FeaturestoreEntityContainersOperations +from ._featurestore_entity_versions_operations import FeaturestoreEntityVersionsOperations +from ._inference_pools_operations import InferencePoolsOperations +from ._inference_endpoints_operations import InferenceEndpointsOperations +from ._inference_groups_operations import InferenceGroupsOperations from ._jobs_operations import JobsOperations +from ._marketplace_subscriptions_operations import MarketplaceSubscriptionsOperations 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 ._serverless_endpoints_operations import ServerlessEndpointsOperations from ._registries_operations import RegistriesOperations from ._workspace_features_operations import WorkspaceFeaturesOperations +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._workspace_connections_operations import WorkspaceConnectionsOperations +from ._connection_operations import ConnectionOperations +from ._connection_rai_blocklists_operations import ConnectionRaiBlocklistsOperations +from ._connection_rai_blocklist_operations import ConnectionRaiBlocklistOperations +from ._connection_rai_blocklist_item_operations import ConnectionRaiBlocklistItemOperations +from ._connection_rai_blocklist_items_operations import ConnectionRaiBlocklistItemsOperations +from ._connection_rai_policies_operations import ConnectionRaiPoliciesOperations +from ._connection_rai_policy_operations import ConnectionRaiPolicyOperations +from ._endpoint_deployment_operations import EndpointDeploymentOperations +from ._endpoint_operations import EndpointOperations +from ._rai_policies_operations import RaiPoliciesOperations +from ._rai_policy_operations import RaiPolicyOperations +from ._managed_network_settings_rule_operations import ManagedNetworkSettingsRuleOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_network_provisions_operations import ManagedNetworkProvisionsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", - "WorkspacesOperations", "UsagesOperations", "VirtualMachineSizesOperations", "QuotasOperations", "ComputeOperations", - "PrivateEndpointConnectionsOperations", - "PrivateLinkResourcesOperations", - "WorkspaceConnectionsOperations", "RegistryCodeContainersOperations", "RegistryCodeVersionsOperations", "RegistryComponentContainersOperations", "RegistryComponentVersionsOperations", "RegistryDataContainersOperations", "RegistryDataVersionsOperations", + "RegistryDataReferencesOperations", "RegistryEnvironmentContainersOperations", "RegistryEnvironmentVersionsOperations", "RegistryModelContainersOperations", "RegistryModelVersionsOperations", "BatchEndpointsOperations", "BatchDeploymentsOperations", + "CapabilityHostsOperations", "CodeContainersOperations", "CodeVersionsOperations", "ComponentContainersOperations", @@ -80,14 +102,42 @@ "DatastoresOperations", "EnvironmentContainersOperations", "EnvironmentVersionsOperations", + "FeaturesetContainersOperations", + "FeaturesOperations", + "FeaturesetVersionsOperations", + "FeaturestoreEntityContainersOperations", + "FeaturestoreEntityVersionsOperations", + "InferencePoolsOperations", + "InferenceEndpointsOperations", + "InferenceGroupsOperations", "JobsOperations", + "MarketplaceSubscriptionsOperations", "ModelContainersOperations", "ModelVersionsOperations", "OnlineEndpointsOperations", "OnlineDeploymentsOperations", "SchedulesOperations", + "ServerlessEndpointsOperations", "RegistriesOperations", "WorkspaceFeaturesOperations", + "Operations", + "WorkspacesOperations", + "WorkspaceConnectionsOperations", + "ConnectionOperations", + "ConnectionRaiBlocklistsOperations", + "ConnectionRaiBlocklistOperations", + "ConnectionRaiBlocklistItemOperations", + "ConnectionRaiBlocklistItemsOperations", + "ConnectionRaiPoliciesOperations", + "ConnectionRaiPolicyOperations", + "EndpointDeploymentOperations", + "EndpointOperations", + "RaiPoliciesOperations", + "RaiPolicyOperations", + "ManagedNetworkSettingsRuleOperations", + "PrivateEndpointConnectionsOperations", + "PrivateLinkResourcesOperations", + "ManagedNetworkProvisionsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() 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 7fcc2d9cfc0..a940ee586ef 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +77,7 @@ def build_list_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +105,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +125,7 @@ def build_delete_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +147,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +167,7 @@ def build_get_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +189,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +214,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,7 +238,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -258,7 +263,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -318,7 +323,6 @@ def list( :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 BatchDeployment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.BatchDeployment] @@ -330,7 +334,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +345,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -350,12 +354,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -367,13 +369,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("BatchDeploymentTrackedResourceArmPaginatedResult", pipeline_response) @@ -383,11 +384,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -400,14 +401,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,30 +416,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -455,12 +455,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -479,14 +479,6 @@ def begin_delete( :type endpoint_name: str :param deployment_name: Inference deployment identifier. Required. :type deployment_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: @@ -500,7 +492,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -511,11 +503,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -526,17 +519,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -555,12 +544,11 @@ def get( :type endpoint_name: str :param deployment_name: The identifier for the Batch deployments. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BatchDeployment or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.BatchDeployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,23 +562,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchDeployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,16 +586,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore def _update_initial( self, @@ -617,10 +599,10 @@ def _update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO], + body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BatchDeployment]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -633,7 +615,7 @@ def _update_initial( api_version: str = 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.BatchDeployment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -643,7 +625,7 @@ def _update_initial( else: _json = self._serialize.body(body, "PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -653,30 +635,29 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchDeployment", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -684,14 +665,12 @@ def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -724,14 +703,6 @@ def begin_update( :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 BatchDeployment or the result of cls(response) :rtype: @@ -746,7 +717,7 @@ def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -765,18 +736,10 @@ def begin_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchDeployment or the result of cls(response) :rtype: @@ -791,7 +754,7 @@ def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO], + body: Union[_models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.BatchDeployment]: """Update a batch inference deployment (asynchronous). @@ -808,21 +771,11 @@ def begin_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Is either a - PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties type or a IO type. Required. + PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties type or a IO[bytes] type. + Required. :type body: ~azure.mgmt.machinelearningservices.models.PartialBatchDeploymentPartialMinimalTrackedResourceWithProperties - 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. + or IO[bytes] :return: An instance of LROPoller that returns either BatchDeployment or the result of cls(response) :rtype: @@ -852,12 +805,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -867,17 +821,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.BatchDeployment].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[_models.BatchDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _create_or_update_initial( self, @@ -885,10 +837,10 @@ def _create_or_update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.BatchDeployment, IO], + body: Union[_models.BatchDeployment, IO[bytes]], **kwargs: Any - ) -> _models.BatchDeployment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -901,7 +853,7 @@ def _create_or_update_initial( api_version: str = 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.BatchDeployment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -911,7 +863,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "BatchDeployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -921,29 +873,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchDeployment", 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") @@ -952,17 +904,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } - @overload def begin_create_or_update( self, @@ -993,14 +941,6 @@ def begin_create_or_update( :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 BatchDeployment or the result of cls(response) :rtype: @@ -1015,7 +955,7 @@ def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1034,18 +974,10 @@ def begin_create_or_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchDeployment or the result of cls(response) :rtype: @@ -1060,7 +992,7 @@ def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.BatchDeployment, IO], + body: Union[_models.BatchDeployment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.BatchDeployment]: """Creates/updates a batch inference deployment (asynchronous). @@ -1077,19 +1009,8 @@ def begin_create_or_update( :param deployment_name: The identifier for the Batch inference deployment. Required. :type deployment_name: str :param body: Batch inference deployment definition object. Is either a BatchDeployment type or - a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.BatchDeployment 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. + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.BatchDeployment or IO[bytes] :return: An instance of LROPoller that returns either BatchDeployment or the result of cls(response) :rtype: @@ -1119,12 +1040,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchDeployment", pipeline_response) + deserialized = self._deserialize("BatchDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1136,14 +1058,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.BatchDeployment].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}/batchEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[_models.BatchDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 afa2aebfed2..b0c7a540a1c 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_delete_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +150,7 @@ def build_get_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +167,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -184,7 +189,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +208,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -225,7 +230,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,7 +249,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -263,7 +268,7 @@ def build_list_keys_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -315,7 +320,6 @@ def list( :type count: 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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.BatchEndpoint] :raises ~azure.core.exceptions.HttpResponseError: @@ -326,7 +330,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -337,19 +341,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, count=count, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -361,13 +363,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("BatchEndpointTrackedResourceArmPaginatedResult", pipeline_response) @@ -377,11 +378,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -394,14 +395,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -413,29 +410,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -448,12 +448,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -470,14 +470,6 @@ def begin_delete( :type workspace_name: str :param endpoint_name: Inference Endpoint name. Required. :type endpoint_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: @@ -491,7 +483,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -501,11 +493,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -516,17 +509,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -543,12 +532,11 @@ def get( :type workspace_name: str :param endpoint_name: Name for the Batch Endpoint. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: BatchEndpoint or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.BatchEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -562,22 +550,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.BatchEndpoint] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -587,26 +573,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore def _update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any - ) -> Optional[_models.BatchEndpoint]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -619,7 +601,7 @@ def _update_initial( api_version: str = 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.BatchEndpoint]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -629,7 +611,7 @@ def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithIdentity") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -638,30 +620,29 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchEndpoint", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -669,14 +650,12 @@ def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -706,14 +685,6 @@ def begin_update( :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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -726,7 +697,7 @@ def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -743,18 +714,10 @@ def begin_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Mutable batch inference endpoint definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -767,7 +730,7 @@ def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.BatchEndpoint]: """Update a batch inference endpoint (asynchronous). @@ -782,20 +745,10 @@ def begin_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Mutable batch inference endpoint definition object. Is either a - PartialMinimalTrackedResourceWithIdentity type or a IO type. Required. + PartialMinimalTrackedResourceWithIdentity type or a IO[bytes] type. Required. :type body: - ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity 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. + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity or + IO[bytes] :return: An instance of LROPoller that returns either BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -823,12 +776,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -838,27 +792,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.BatchEndpoint].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/workspaces/{workspaceName}/batchEndpoints/{endpointName}" - } + return LROPoller[_models.BatchEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.BatchEndpoint, IO], + body: Union[_models.BatchEndpoint, IO[bytes]], **kwargs: Any - ) -> _models.BatchEndpoint: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -871,7 +823,7 @@ def _create_or_update_initial( api_version: str = 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.BatchEndpoint] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -881,7 +833,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "BatchEndpoint") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -890,29 +842,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("BatchEndpoint", 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") @@ -921,17 +873,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/batchEndpoints/{endpointName}" - } - @overload def begin_create_or_update( self, @@ -959,14 +907,6 @@ def begin_create_or_update( :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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -979,7 +919,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -996,18 +936,10 @@ def begin_create_or_update( :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str :param body: Batch inference endpoint definition object. Required. - :type body: IO + :type body: IO[bytes] :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 BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -1020,7 +952,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.BatchEndpoint, IO], + body: Union[_models.BatchEndpoint, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.BatchEndpoint]: """Creates a batch inference endpoint (asynchronous). @@ -1034,20 +966,9 @@ def begin_create_or_update( :type workspace_name: str :param endpoint_name: Name for the Batch inference endpoint. Required. :type endpoint_name: str - :param body: Batch inference endpoint definition object. Is either a BatchEndpoint type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.BatchEndpoint 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. + :param body: Batch inference endpoint definition object. Is either a BatchEndpoint type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.BatchEndpoint or IO[bytes] :return: An instance of LROPoller that returns either BatchEndpoint or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.BatchEndpoint] @@ -1075,12 +996,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("BatchEndpoint", pipeline_response) + deserialized = self._deserialize("BatchEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1092,17 +1014,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.BatchEndpoint].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}/batchEndpoints/{endpointName}" - } + return LROPoller[_models.BatchEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_keys( @@ -1119,12 +1039,11 @@ def list_keys( :type workspace_name: str :param endpoint_name: Inference Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthKeys or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1138,22 +1057,20 @@ def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1163,13 +1080,9 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/batchEndpoints/{endpointName}/listkeys" - } + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capability_hosts_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capability_hosts_operations.py new file mode 100644 index 00000000000..3ecae1a5ede --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_capability_hosts_operations.py @@ -0,0 +1,579 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_delete_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/capabilityHosts/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/capabilityHosts/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/capabilityHosts/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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 CapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`capability_hosts` 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") + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete capabilityHost. + + Delete capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.CapabilityHost: + """Get capabilityHost. + + Get capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.CapabilityHost + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapabilityHost + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update capabilityHost. + + Create or update capabilityHost. + + :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 name: CapabilityHost name. Required. + :type name: str + :param body: CapabilityHost definition. Is either a CapabilityHost type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.CapabilityHost or IO[bytes] + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.CapabilityHost] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 bd3a7ea7d40..58ed4f1e67c 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +64,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,7 +83,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +102,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,7 +119,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +138,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,7 +155,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -172,7 +175,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,7 +222,6 @@ def list( :type workspace_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: @@ -230,7 +232,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -241,18 +243,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -264,13 +264,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CodeContainerResourceArmPaginatedResult", pipeline_response) @@ -280,11 +279,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,10 +296,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -316,12 +311,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,22 +329,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,11 +353,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/codes/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.CodeContainer: @@ -380,12 +368,11 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -399,22 +386,20 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,16 +409,12 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -462,7 +443,6 @@ def create_or_update( :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: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -474,7 +454,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -491,11 +471,10 @@ def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -507,7 +486,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any ) -> _models.CodeContainer: """Create or update container. @@ -521,18 +500,14 @@ def create_or_update( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :param body: Container entity to create or update. Is either a CodeContainer 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 + :param body: Container entity to create or update. Is either a CodeContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO[bytes] :return: CodeContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -555,7 +530,7 @@ def create_or_update( else: _json = self._serialize.body(body, "CodeContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -564,16 +539,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -583,17 +556,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CodeContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}" - } 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 85aa291231f..aa17e775001 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +60,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +79,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +106,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +126,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +143,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +163,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +180,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -194,7 +201,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,13 +214,53 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_get_start_pending_upload_request( +def build_publish_request( resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/codes/{name}/versions/{version}/publish", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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_create_or_get_start_pending_upload_request( # pylint: disable=name-too-long + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -234,7 +281,7 @@ def build_create_or_get_start_pending_upload_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -301,7 +348,6 @@ def list( :type hash: str :param hash_version: Hash algorithm version when listing by hash. Default value is None. :type hash_version: 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: @@ -312,7 +358,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +369,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -334,12 +380,10 @@ def prepare_request(next_link=None): hash=hash, hash_version=hash_version, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -351,13 +395,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CodeVersionResourceArmPaginatedResult", pipeline_response) @@ -367,11 +410,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,10 +427,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -405,12 +444,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,23 +462,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -451,11 +487,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/codes/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -474,12 +506,11 @@ def get( :type 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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -493,23 +524,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,16 +548,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -560,7 +585,6 @@ def create_or_update( :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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -573,7 +597,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -592,11 +616,10 @@ def create_or_update( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -609,7 +632,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any ) -> _models.CodeVersion: """Create or update version. @@ -625,18 +648,14 @@ def create_or_update( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Version entity to create or update. Is either a CodeVersion 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 + :param body: Version entity to create or update. Is either a CodeVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO[bytes] :return: CodeVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.CodeVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +678,7 @@ def create_or_update( else: _json = self._serialize.body(body, "CodeVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -669,16 +688,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,20 +705,235 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("CodeVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}" - } + def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @overload def create_or_get_start_pending_upload( @@ -733,7 +965,6 @@ def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -746,7 +977,7 @@ def create_or_get_start_pending_upload( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -765,11 +996,10 @@ def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -782,7 +1012,7 @@ def create_or_get_start_pending_upload( workspace_name: str, name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a code asset to. @@ -798,18 +1028,14 @@ def create_or_get_start_pending_upload( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -832,7 +1058,7 @@ def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -842,16 +1068,14 @@ def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -861,13 +1085,9 @@ def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/codes/{name}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 0bc38057f34..8947631afd0 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +70,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +91,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +110,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +127,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +146,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +163,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +183,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +238,6 @@ 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 - :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] @@ -247,7 +249,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -258,19 +260,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -282,13 +282,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ComponentContainerResourceArmPaginatedResult", pipeline_response) @@ -298,11 +297,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -315,10 +314,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -334,12 +329,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -353,22 +347,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -379,11 +371,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/components/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -400,12 +388,11 @@ def get( :type workspace_name: str :param name: Container name. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,22 +406,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,16 +429,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -482,7 +463,6 @@ def create_or_update( :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: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -494,7 +474,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -511,11 +491,10 @@ def create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -527,7 +506,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any ) -> _models.ComponentContainer: """Create or update container. @@ -541,18 +520,14 @@ def create_or_update( :type workspace_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a ComponentContainer 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 + :param body: Container entity to create or update. Is either a ComponentContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO[bytes] :return: ComponentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -575,7 +550,7 @@ def create_or_update( else: _json = self._serialize.body(body, "ComponentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -584,16 +559,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -603,17 +576,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ComponentContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}" - } 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 932e842e43d..bd811a73f74 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +59,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +78,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +103,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +123,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +140,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +160,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +177,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +198,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -204,6 +211,46 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_publish_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/components/{name}/versions/{version}/publish", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 ComponentVersionsOperations: """ .. warning:: @@ -255,7 +302,6 @@ 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 - :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] @@ -267,7 +313,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +324,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -288,12 +334,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -305,13 +349,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ComponentVersionResourceArmPaginatedResult", pipeline_response) @@ -321,11 +364,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,10 +381,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -359,12 +398,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,23 +416,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,11 +441,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/components/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -428,12 +460,11 @@ def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,23 +478,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,16 +502,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -514,7 +539,6 @@ def create_or_update( :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: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -527,7 +551,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -546,11 +570,10 @@ def create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -563,7 +586,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any ) -> _models.ComponentVersion: """Create or update version. @@ -579,18 +602,14 @@ def create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ComponentVersion 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 + :param body: Version entity to create or update. Is either a ComponentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO[bytes] :return: ComponentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComponentVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -613,7 +632,7 @@ def create_or_update( else: _json = self._serialize.body(body, "ComponentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -623,16 +642,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,17 +659,232 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ComponentVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/components/{name}/versions/{version}" - } + def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 349245e851f..12fe61dbc95 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +87,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,10 +103,12 @@ def build_get_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +125,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,10 +142,12 @@ def build_create_or_update_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -157,7 +166,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,10 +183,12 @@ def build_update_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -202,7 +213,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,10 +229,12 @@ def build_delete_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,13 +248,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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), + } + + _url: str = _url.format(**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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -257,10 +311,12 @@ def build_list_nodes_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -277,7 +333,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -293,15 +349,58 @@ def build_list_keys_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), + } + + _url: str = _url.format(**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_update_data_mounts_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/updateDataMounts", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) @@ -313,7 +412,7 @@ def build_start_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -329,10 +428,12 @@ def build_start_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -349,7 +450,7 @@ def build_stop_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -365,10 +466,12 @@ def build_stop_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -385,7 +488,7 @@ def build_restart_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -401,21 +504,143 @@ def build_restart_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "computeName": _SERIALIZER.url("compute_name", compute_name, "str"), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), + } + + _url: str = _url.format(**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_update_idle_shutdown_setting_request( # pylint: disable=name-too-long + 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), + } + + _url: str = _url.format(**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_get_allowed_resize_sizes_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/getAllowedVmSizesForResize", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), + } + + _url: str = _url.format(**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_resize_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/resize", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "computeName": _SERIALIZER.url( + "compute_name", compute_name, "str", pattern=r"^[a-zA-Z](?![a-zA-Z0-9-]*-\d+$)[a-zA-Z0-9\-]{2,23}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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: +class ComputeOperations: # pylint: disable=too-many-public-methods """ .. warning:: **DO NOT** instantiate this class directly. @@ -447,7 +672,6 @@ def list( :type workspace_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 ComputeResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ComputeResource] @@ -459,7 +683,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PaginatedComputeResourcesList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,18 +694,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -493,13 +715,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PaginatedComputeResourcesList", pipeline_response) @@ -509,11 +730,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -526,10 +747,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes" - } - @distributed_trace def get( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -544,12 +761,11 @@ def get( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ComputeResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComputeResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -563,22 +779,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComputeResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_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, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -588,26 +802,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ComputeResource, IO], + parameters: Union[_models.ComputeResource, IO[bytes]], **kwargs: Any - ) -> _models.ComputeResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +830,7 @@ def _create_or_update_initial( api_version: str = 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.ComputeResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -630,7 +840,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(parameters, "ComputeResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -639,45 +849,41 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ComputeResource", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/computes/{computeName}" - } - @overload def begin_create_or_update( self, @@ -705,14 +911,6 @@ def begin_create_or_update( :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 ComputeResource or the result of cls(response) :rtype: @@ -726,7 +924,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -743,18 +941,10 @@ def begin_create_or_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Payload with Machine Learning compute definition. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 ComputeResource or the result of cls(response) :rtype: @@ -768,7 +958,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ComputeResource, IO], + parameters: Union[_models.ComputeResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ComputeResource]: """Creates or updates compute. This call will overwrite a compute if it exists. This is a @@ -783,19 +973,8 @@ def begin_create_or_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Payload with Machine Learning compute definition. Is either a - ComputeResource type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.ComputeResource 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. + ComputeResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ComputeResource or IO[bytes] :return: An instance of LROPoller that returns either ComputeResource or the result of cls(response) :rtype: @@ -824,12 +1003,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -839,27 +1019,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ComputeResource].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}/computes/{computeName}" - } + return LROPoller[_models.ComputeResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ClusterUpdateParameters, IO], + parameters: Union[_models.ClusterUpdateParameters, IO[bytes]], **kwargs: Any - ) -> _models.ComputeResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -872,7 +1050,7 @@ def _update_initial( api_version: str = 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.ComputeResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -882,7 +1060,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "ClusterUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -891,35 +1069,34 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ComputeResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -947,14 +1124,6 @@ def begin_update( :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 ComputeResource or the result of cls(response) :rtype: @@ -968,7 +1137,7 @@ def begin_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -984,18 +1153,10 @@ def begin_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Additional parameters for cluster update. Required. - :type parameters: IO + :type parameters: IO[bytes] :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 ComputeResource or the result of cls(response) :rtype: @@ -1009,7 +1170,7 @@ def begin_update( resource_group_name: str, workspace_name: str, compute_name: str, - parameters: Union[_models.ClusterUpdateParameters, IO], + parameters: Union[_models.ClusterUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ComputeResource]: """Updates properties of a compute. This call will overwrite a compute if it exists. This is a @@ -1023,19 +1184,9 @@ def begin_update( :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str :param parameters: Additional parameters for cluster update. Is either a - ClusterUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.ClusterUpdateParameters 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. + ClusterUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ClusterUpdateParameters or + IO[bytes] :return: An instance of LROPoller that returns either ComputeResource or the result of cls(response) :rtype: @@ -1064,12 +1215,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComputeResource", pipeline_response) + deserialized = self._deserialize("ComputeResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1079,27 +1231,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ComputeResource].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/workspaces/{workspaceName}/computes/{computeName}" - } + return LROPoller[_models.ComputeResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, underlying_resource_action: Union[str, _models.UnderlyingResourceAction], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1111,30 +1261,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, subscription_id=self._config.subscription_id, underlying_resource_action=underlying_resource_action, 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -1146,12 +1299,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements ) response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -1176,14 +1329,6 @@ def begin_delete( Required. :type underlying_resource_action: str or ~azure.mgmt.machinelearningservices.models.UnderlyingResourceAction - :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: @@ -1197,7 +1342,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1208,11 +1353,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1221,23 +1367,26 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/computes/{computeName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - @distributed_trace - def list_nodes( - self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any - ) -> Iterable["_models.AmlComputeNodeInformation"]: - """Get the details (e.g IP address, port etc) of all the compute nodes in the compute. + @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. @@ -1246,42 +1395,170 @@ def list_nodes( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AmlComputeNodeInformation or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AmlComputeNodeInformation] + :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 + :return: None or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AmlComputeNodesInformation] = kwargs.pop("cls", None) - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + @overload + def update_custom_services( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + custom_services: IO[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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 [CustomService] type or a + IO[bytes] type. Required. + :type custom_services: list[~azure.mgmt.machinelearningservices.models.CustomService] or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, (IOBase, 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def list_nodes( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> Iterable["_models.AmlComputeNodeInformation"]: + """Get the details (e.g IP address, port etc) of all the compute nodes in the compute. + + :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 + :return: An iterator like instance of either AmlComputeNodeInformation or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AmlComputeNodeInformation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.AmlComputeNodesInformation] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_nodes_request( + _request = build_list_nodes_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, - template_url=self.list_nodes.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1293,13 +1570,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("AmlComputeNodesInformation", pipeline_response) @@ -1309,11 +1585,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1326,10 +1602,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_nodes.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listNodes" - } - @distributed_trace def list_keys( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any @@ -1343,12 +1615,11 @@ def list_keys( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ComputeSecrets or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ComputeSecrets :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1362,22 +1633,20 @@ def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComputeSecrets] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_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, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1387,21 +1656,108 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComputeSecrets", pipeline_response) + deserialized = self._deserialize("ComputeSecrets", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/listKeys" - } + @overload + def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: List[_models.ComputeInstanceDataMount], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update Data Mounts of a Machine Learning compute. - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. + Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Update Data Mounts of a Machine Learning compute. + + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. + Required. + :type data_mounts: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_data_mounts( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + data_mounts: Union[List[_models.ComputeInstanceDataMount], IO[bytes]], + **kwargs: Any ) -> None: - error_map = { + """Update Data Mounts of a Machine Learning compute. + + Update Data Mounts of a Machine Learning compute. + + :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 data_mounts: The parameters for creating or updating a machine learning workspace. Is + either a [ComputeInstanceDataMount] type or a IO[bytes] type. Required. + :type data_mounts: list[~azure.mgmt.machinelearningservices.models.ComputeInstanceDataMount] or + IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1409,43 +1765,101 @@ def _start_initial( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = 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) - request = build_start_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(data_mounts, (IOBase, bytes)): + _content = data_mounts + else: + _json = self._serialize.body(data_mounts, "[ComputeInstanceDataMount]") + + _request = build_update_data_mounts_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, - template_url=self._start_initial.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **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, {}) # type: ignore + + def _start_initial( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_start_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start" - } + return deserialized # type: ignore @distributed_trace def begin_start( @@ -1460,14 +1874,6 @@ def begin_start( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1481,7 +1887,7 @@ def begin_start( 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._start_initial( # type: ignore + raw_result = self._start_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1491,11 +1897,12 @@ def begin_start( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1504,22 +1911,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/start" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements + def _stop_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1531,39 +1934,42 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_stop_request( + _request = build_stop_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, - template_url=self._stop_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop" - } + return deserialized # type: ignore @distributed_trace def begin_stop( @@ -1578,14 +1984,6 @@ def begin_stop( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1599,7 +1997,7 @@ def begin_stop( 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._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1609,11 +2007,12 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1622,22 +2021,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/stop" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements + def _restart_initial( self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1649,39 +2044,42 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_restart_request( + _request = build_restart_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, - template_url=self._restart_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/computes/{computeName}/restart" - } + return deserialized # type: ignore @distributed_trace def begin_restart( @@ -1696,14 +2094,6 @@ def begin_restart( :type workspace_name: str :param compute_name: Name of the Azure Machine Learning compute. Required. :type compute_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: @@ -1717,7 +2107,7 @@ def begin_restart( 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._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, compute_name=compute_name, @@ -1727,11 +2117,12 @@ def begin_restart( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1740,14 +2131,413 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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 + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - 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 + :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[bytes], + *, + 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[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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[bytes]], + **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 IdleShutdownSetting type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.IdleShutdownSetting or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, (IOBase, 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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def get_allowed_resize_sizes( + self, resource_group_name: str, workspace_name: str, compute_name: str, **kwargs: Any + ) -> _models.VirtualMachineSizeListResult: + """Returns supported virtual machine sizes for resize. + + :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 + :return: VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) + + _request = build_get_allowed_resize_sizes_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("VirtualMachineSizeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _resize_initial( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResizeSchema") + + _request = build_resize_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, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: _models.ResizeSchema, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. + Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. + Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_resize( + self, + resource_group_name: str, + workspace_name: str, + compute_name: str, + parameters: Union[_models.ResizeSchema, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Updates the size 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 VM size setting of specified Compute Instance. Is + either a ResizeSchema type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.ResizeSchema or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._resize_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + compute_name=compute_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_operations.py new file mode 100644 index 00000000000..e2d422bdff3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_operations.py @@ -0,0 +1,1055 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_deployments_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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_delete_deployment_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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_deployment_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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_deployment_request( # pylint: disable=name-too-long + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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_get_models_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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_get_all_models_request( + resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listConnectionModels", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 ConnectionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection` 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_deployments( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the Azure OpenAI connection. + + Get all the deployments under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_deployments_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_deployment_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete Azure OpenAI connection deployment resource by name. + + Delete Azure OpenAI connection deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_deployment( + self, resource_group_name: str, workspace_name: str, connection_name: str, deployment_name: str, **kwargs: Any + ) -> _models.EndpointDeploymentResourcePropertiesBasicResource: + """Get deployments under the Azure OpenAI connection by name. + + Get deployments under the Azure OpenAI connection by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_deployment_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointDeploymentResourcePropertiesBasicResource") + + _request = build_create_or_update_deployment_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: _models.EndpointDeploymentResourcePropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_deployment( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update Azure OpenAI connection deployment resource with the specified parameters. + + Create or update Azure OpenAI connection deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Is either a EndpointDeploymentResourcePropertiesBasicResource + type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointDeploymentResourcePropertiesBasicResource] = 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_deployment_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + deployment_name=deployment_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointDeploymentResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_models( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.EndpointModelProperties"]: + """Get available models under the Azure OpenAI connection. + + Get available models under the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either EndpointModelProperties or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get_all_models(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.EndpointModels: + """Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + Get models under the Azure ML workspace for all Azure OpenAI connections that the user can + deploy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: EndpointModels or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointModels + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + _request = build_get_all_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointModels", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_item_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_item_operations.py new file mode 100644 index 00000000000..f90b4efb663 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_item_operations.py @@ -0,0 +1,1186 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, List, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_add_bulk_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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_delete_bulk_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + subscription_id: str, + *, + json: JSON, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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, json=json, **kwargs) + + +def build_delete_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "raiBlocklistItemName": _SERIALIZER.url( + "rai_blocklist_item_name", rai_blocklist_item_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "raiBlocklistItemName": _SERIALIZER.url( + "rai_blocklist_item_name", rai_blocklist_item_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "raiBlocklistItemName": _SERIALIZER.url( + "rai_blocklist_item_name", rai_blocklist_item_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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 ConnectionRaiBlocklistItemOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist_item` 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") + + def _add_bulk_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[List[_models.RaiBlocklistItemBulkRequest], IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "[RaiBlocklistItemBulkRequest]") + + _request = build_add_bulk_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: List[_models.RaiBlocklistItemBulkRequest], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Required. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_add_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[List[_models.RaiBlocklistItemBulkRequest], IO[bytes]], + **kwargs: Any + ) -> LROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]: + """Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + Add multiple blocklist items to the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Properties describing the custom blocklist items. Is either a + [RaiBlocklistItemBulkRequest] type or a IO[bytes] type. Required. + :type body: list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemBulkRequest] or + IO[bytes] + :return: An instance of LROPoller that returns either list of + RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[list[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource]] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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[List[_models.RaiBlocklistItemPropertiesBasicResource]] = 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._add_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "[RaiBlocklistItemPropertiesBasicResource]", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[List[_models.RaiBlocklistItemPropertiesBasicResource]].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[List[_models.RaiBlocklistItemPropertiesBasicResource]]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_bulk_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: JSON, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_delete_bulk_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_bulk( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: JSON, + **kwargs: Any + ) -> LROPoller[None]: + """Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + Delete multiple blocklist items from the specified blocklist associated with the Azure OpenAI + connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: List of RAI Blocklist Items Names. Required. + :type body: JSON + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + 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_bulk_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistItemPropertiesBasicResource: + """Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + Gets the specified custom blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :return: RaiBlocklistItemPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistItemPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiBlocklistItemPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: Union[_models.RaiBlocklistItemPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiBlocklistItemPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: _models.RaiBlocklistItemPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiBlocklistItemPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiBlocklistItemPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + rai_blocklist_item_name: str, + body: Union[_models.RaiBlocklistItemPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistItemPropertiesBasicResource]: + """Update the state of specified blocklist item associated with the Azure OpenAI connection. + + Update the state of specified blocklist item associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param rai_blocklist_item_name: Name of the RaiBlocklist Item. Required. + :type rai_blocklist_item_name: str + :param body: Is either a RaiBlocklistItemPropertiesBasicResource type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource + or IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of LROPoller that returns either RaiBlocklistItemPropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiBlocklistItemPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + rai_blocklist_item_name=rai_blocklist_item_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiBlocklistItemPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiBlocklistItemPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RaiBlocklistItemPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_items_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_items_operations.py new file mode 100644 index 00000000000..77b8c15cab2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_items_operations.py @@ -0,0 +1,214 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, TypeVar +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.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + connection_name: str, + rai_blocklist_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConnectionRaiBlocklistItemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist_items` 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, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RaiBlocklistItemPropertiesBasicResource"]: + """Gets the custom blocklist items associated with the Azure OpenAI connection. + + Gets the custom blocklist items associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiBlocklistItemPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistItemPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "RaiBlocklistItemPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_operations.py new file mode 100644 index 00000000000..45c1bbaca6f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklist_operations.py @@ -0,0 +1,662 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_delete_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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, + connection_name: str, + rai_blocklist_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/raiBlocklists/{raiBlocklistName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiBlocklistName": _SERIALIZER.url( + "rai_blocklist_name", rai_blocklist_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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 ConnectionRaiBlocklistOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklist` 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") + + def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + Deletes the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + **kwargs: Any + ) -> _models.RaiBlocklistPropertiesBasicResource: + """Gets the specified custom blocklist associated with the Azure OpenAI connection. + + Gets the specified custom blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :return: RaiBlocklistPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiBlocklistPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[_models.RaiBlocklistPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiBlocklistPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: _models.RaiBlocklistPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiBlocklistPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiBlocklistPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_blocklist_name: str, + body: Union[_models.RaiBlocklistPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.RaiBlocklistPropertiesBasicResource]: + """Update the state of specified blocklist associated with the Azure OpenAI connection. + + Update the state of specified blocklist associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_blocklist_name: The name of the RaiBlocklist. Required. + :type rai_blocklist_name: str + :param body: Is either a RaiBlocklistPropertiesBasicResource type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of LROPoller that returns either RaiBlocklistPropertiesBasicResource or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiBlocklistPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_blocklist_name=rai_blocklist_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiBlocklistPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RaiBlocklistPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklists_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklists_operations.py new file mode 100644 index 00000000000..cf5f94a6324 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_blocklists_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, TypeVar +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.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + connection_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiBlocklists", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConnectionRaiBlocklistsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_blocklists` 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, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RaiBlocklistPropertiesBasicResource"]: + """Gets the custom blocklists associated with the Azure OpenAI connection. + + Gets the custom blocklists associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiBlocklistPropertiesBasicResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiBlocklistPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiBlocklistPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiBlocklistPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policies_operations.py new file mode 100644 index 00000000000..9769614f5c0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policies_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, TypeVar +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.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + connection_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ConnectionRaiPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_policies` 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, + connection_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RaiPolicyPropertiesBasicResource"]: + """List the specified Content Filters associated with the Azure OpenAI connection. + + List the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiPolicyPropertiesBasicResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policy_operations.py new file mode 100644 index 00000000000..c6e957d557f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_connection_rai_policy_operations.py @@ -0,0 +1,656 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_delete_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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, + connection_name: str, + rai_policy_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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 ConnectionRaiPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`connection_rai_policy` 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") + + def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI connection. + + Deletes the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, connection_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicyPropertiesBasicResource: + """Gets the specified Content Filters associated with the Azure OpenAI connection. + + Gets the specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :return: RaiPolicyPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiPolicyPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: _models.RaiPolicyPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI connection. + + Update the state of specified Content Filters associated with the Azure OpenAI connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Is either a RaiPolicyPropertiesBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiPolicyPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + rai_policy_name=rai_policy_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiPolicyPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RaiPolicyPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 48c5dee07f2..37e2691c450 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +70,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +91,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +110,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +127,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +146,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +163,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +183,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +238,6 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataContainer or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.DataContainer] :raises ~azure.core.exceptions.HttpResponseError: @@ -246,7 +248,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -257,19 +259,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -281,13 +281,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DataContainerResourceArmPaginatedResult", pipeline_response) @@ -297,11 +296,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,10 +313,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -333,12 +328,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -352,22 +346,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -378,11 +370,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/data/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.DataContainer: @@ -397,12 +385,11 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs :type workspace_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -416,22 +403,20 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -441,16 +426,12 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -479,7 +460,6 @@ def create_or_update( :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: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -491,7 +471,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -508,11 +488,10 @@ def create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -524,7 +503,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any ) -> _models.DataContainer: """Create or update container. @@ -538,18 +517,14 @@ def create_or_update( :type workspace_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a DataContainer type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataContainer 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 + :param body: Container entity to create or update. Is either a DataContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataContainer or IO[bytes] :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +547,7 @@ def create_or_update( else: _json = self._serialize.body(body, "DataContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -581,16 +556,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -600,17 +573,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DataContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}" - } 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 e355736e935..d9a292f2150 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +60,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +79,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +106,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +126,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +143,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +163,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,7 +180,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -194,7 +201,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,6 +214,46 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_publish_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/data/{name}/versions/{version}/publish", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 DataVersionsOperations: """ .. warning:: @@ -266,7 +313,6 @@ def list( ListViewType.All]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 DataVersionBase or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.DataVersionBase] @@ -278,7 +324,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +335,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -300,12 +346,10 @@ def prepare_request(next_link=None): tags=tags, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -317,13 +361,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DataVersionBaseResourceArmPaginatedResult", pipeline_response) @@ -333,11 +376,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -350,10 +393,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -371,12 +410,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,23 +428,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -417,11 +453,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/data/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -440,12 +472,11 @@ def get( :type 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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,23 +490,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -485,16 +514,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -526,7 +551,6 @@ def create_or_update( :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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: @@ -539,7 +563,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -558,11 +582,10 @@ def create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: @@ -575,7 +598,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any ) -> _models.DataVersionBase: """Create or update version. @@ -591,18 +614,14 @@ def create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a DataVersionBase type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase 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 + :param body: Version entity to create or update. Is either a DataVersionBase type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase or IO[bytes] :return: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,7 +644,7 @@ def create_or_update( else: _json = self._serialize.body(body, "DataVersionBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -635,16 +654,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,17 +671,232 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DataVersionBase", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/data/{name}/versions/{version}" - } + def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 651ac883ae0..ff2636915af 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, List, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +57,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +75,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -103,7 +106,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +125,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,7 +142,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +161,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +184,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -201,7 +204,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,7 +225,8 @@ def build_list_secrets_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,12 +245,14 @@ def build_list_secrets_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) @@ -308,7 +314,6 @@ def list( :type order_by: str :param order_by_asc: Order by property in ascending order. Default value is False. :type order_by_asc: bool - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Datastore or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Datastore] :raises ~azure.core.exceptions.HttpResponseError: @@ -319,7 +324,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoreResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -330,7 +335,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -342,12 +347,10 @@ def prepare_request(next_link=None): order_by=order_by, order_by_asc=order_by_asc, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -359,13 +362,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DatastoreResourceArmPaginatedResult", pipeline_response) @@ -375,11 +377,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -392,10 +394,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -411,12 +409,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,22 +427,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -456,11 +451,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/datastores/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.Datastore: @@ -475,12 +466,11 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -494,22 +484,20 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -519,16 +507,12 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Datastore", pipeline_response) + deserialized = self._deserialize("Datastore", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -560,7 +544,6 @@ def create_or_update( :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: @@ -572,7 +555,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], skip_validation: bool = False, *, content_type: str = "application/json", @@ -590,13 +573,12 @@ def create_or_update( :param name: Datastore name. Required. :type name: str :param body: Datastore entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :param skip_validation: Flag to skip validation. Default value is False. :type skip_validation: bool :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: @@ -608,7 +590,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.Datastore, IO], + body: Union[_models.Datastore, IO[bytes]], skip_validation: bool = False, **kwargs: Any ) -> _models.Datastore: @@ -623,20 +605,16 @@ def create_or_update( :type workspace_name: str :param name: Datastore name. Required. :type name: str - :param body: Datastore entity to create or update. Is either a Datastore type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.Datastore or IO + :param body: Datastore entity to create or update. Is either a Datastore type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Datastore or IO[bytes] :param skip_validation: Flag to skip validation. Default value is False. :type skip_validation: bool - :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: Datastore or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Datastore :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -659,7 +637,7 @@ def create_or_update( else: _json = self._serialize.body(body, "Datastore") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -669,16 +647,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -688,24 +664,85 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("Datastore", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Datastore", pipeline_response) + deserialized = self._deserialize("Datastore", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}" - } + @overload + def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[_models.SecretExpiry] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatastoreSecrets: + """Get datastore secrets. + + Get datastore secrets. + + :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 name: Datastore name. Required. + :type name: str + :param body: Secret expiry information. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.SecretExpiry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DatastoreSecrets or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_secrets( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DatastoreSecrets: + """Get datastore secrets. + + Get datastore secrets. + + :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 name: Datastore name. Required. + :type name: str + :param body: Secret expiry information. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DatastoreSecrets or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace def list_secrets( - self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Optional[Union[_models.SecretExpiry, IO[bytes]]] = None, + **kwargs: Any ) -> _models.DatastoreSecrets: """Get datastore secrets. @@ -718,12 +755,14 @@ def list_secrets( :type workspace_name: str :param name: Datastore name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param body: Secret expiry information. Is either a SecretExpiry type or a IO[bytes] type. + Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.SecretExpiry or IO[bytes] :return: DatastoreSecrets or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DatastoreSecrets :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -731,28 +770,41 @@ def list_secrets( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = 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.DatastoreSecrets] = kwargs.pop("cls", None) - request = build_list_secrets_request( + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "SecretExpiry") + else: + _json = None + + _request = build_list_secrets_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_secrets.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -762,13 +814,9 @@ def list_secrets( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DatastoreSecrets", pipeline_response) + deserialized = self._deserialize("DatastoreSecrets", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_secrets.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/datastores/{name}/listSecrets" - } + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_deployment_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_deployment_operations.py new file mode 100644 index 00000000000..479fbac393b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_deployment_operations.py @@ -0,0 +1,938 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_get_in_workspace_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + endpoint_type: Optional[Union[str, _models.EndpointType]] = 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/deployments", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if endpoint_type is not None: + _params["endpointType"] = _SERIALIZER.query("endpoint_type", endpoint_type, "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, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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_delete_request( + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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, + endpoint_name: str, + deployment_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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, + workspace_name: str, + endpoint_name: str, + deployment_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/endpoints/{endpointName}/deployments/{deploymentName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 EndpointDeploymentOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`endpoint_deployment` 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 get_in_workspace( + self, + resource_group_name: str, + workspace_name: str, + endpoint_type: Optional[Union[str, _models.EndpointType]] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the workspace scope. + + Get all the deployments under the workspace scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. Known values are: "Azure.OpenAI", "Azure.Speech", + "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and "serverlessEndpoint". + Default value is None. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_in_workspace_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + endpoint_type=endpoint_type, + skip=skip, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def list( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.EndpointDeploymentResourcePropertiesBasicResource"]: + """Get all the deployments under the endpoint resource scope. + + Get all the deployments under the endpoint resource scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: An iterator like instance of either EndpointDeploymentResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop( + "cls", None + ) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Delete endpoint deployment resource by name. + + Delete endpoint deployment resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any + ) -> _models.EndpointDeploymentResourcePropertiesBasicResource: + """Get deployments under endpoint resource by name. + + Get deployments under endpoint resource by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :return: EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointDeploymentResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointDeploymentResourcePropertiesBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: _models.EndpointDeploymentResourcePropertiesBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + deployment_name: str, + body: Union[_models.EndpointDeploymentResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]: + """Create or update endpoint deployment resource with the specified parameters. + + Create or update endpoint deployment resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param deployment_name: Name of the deployment resource. Required. + :type deployment_name: str + :param body: deployment object. Is either a EndpointDeploymentResourcePropertiesBasicResource + type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource or + IO[bytes] + :return: An instance of LROPoller that returns either + EndpointDeploymentResourcePropertiesBasicResource or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointDeploymentResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointDeploymentResourcePropertiesBasicResource] = 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, + endpoint_name=endpoint_name, + deployment_name=deployment_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize( + "EndpointDeploymentResourcePropertiesBasicResource", pipeline_response.http_response + ) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointDeploymentResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.EndpointDeploymentResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_operations.py new file mode 100644 index 00000000000..f36cd2b4b88 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_endpoint_operations.py @@ -0,0 +1,1027 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + *, + endpoint_type: Optional[Union[str, _models.EndpointType]] = None, + include_online_endpoints: bool = False, + include_serverless_endpoints: bool = False, + include_connections: bool = False, + skip: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if endpoint_type is not None: + _params["endpointType"] = _SERIALIZER.query("endpoint_type", endpoint_type, "str") + if include_online_endpoints is not None: + _params["includeOnlineEndpoints"] = _SERIALIZER.query( + "include_online_endpoints", include_online_endpoints, "bool" + ) + if include_serverless_endpoints is not None: + _params["includeServerlessEndpoints"] = _SERIALIZER.query( + "include_serverless_endpoints", include_serverless_endpoints, "bool" + ) + if include_connections is not None: + _params["includeConnections"] = _SERIALIZER.query("include_connections", include_connections, "bool") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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_list_keys_request( + resource_group_name: str, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/listKeys", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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_get_models_request( + resource_group_name: str, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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_regenerate_keys_request( + resource_group_name: str, workspace_name: str, endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/endpoints/{endpointName}/regenerateKey", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**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 EndpointOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`endpoint` 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, + endpoint_type: Optional[Union[str, _models.EndpointType]] = None, + include_online_endpoints: bool = False, + include_serverless_endpoints: bool = False, + include_connections: bool = False, + skip: Optional[str] = None, + expand: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.EndpointResourcePropertiesBasicResource"]: + """List All the endpoints under this workspace. + + List All the endpoints under this 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_type: Endpoint type filter. Known values are: "Azure.OpenAI", "Azure.Speech", + "Azure.ContentSafety", "Azure.Llama", "managedOnlineEndpoint", and "serverlessEndpoint". + Default value is None. + :type endpoint_type: str or ~azure.mgmt.machinelearningservices.models.EndpointType + :param include_online_endpoints: Default value is False. + :type include_online_endpoints: bool + :param include_serverless_endpoints: Default value is False. + :type include_serverless_endpoints: bool + :param include_connections: Default value is False. + :type include_connections: bool + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param expand: Whether the endpoint resource will be expand to include deployment information, + e.g. $expand=deployments. Default value is None. + :type expand: str + :return: An iterator like instance of either EndpointResourcePropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointResourcePropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_type=endpoint_type, + include_online_endpoints=include_online_endpoints, + include_serverless_endpoints=include_serverless_endpoints, + include_connections=include_connections, + skip=skip, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "EndpointResourcePropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.EndpointResourcePropertiesBasicResource: + """Gets endpoint resource. + + Gets endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: EndpointResourcePropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointResourcePropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointResourcePropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "EndpointResourcePropertiesBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: _models.EndpointResourcePropertiesBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either EndpointResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either EndpointResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.EndpointResourcePropertiesBasicResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.EndpointResourcePropertiesBasicResource]: + """Create or update endpoint resource with the specified parameters. + + Create or update endpoint resource with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Endpoint resource object. Is either a EndpointResourcePropertiesBasicResource type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource + or IO[bytes] + :return: An instance of LROPoller that returns either EndpointResourcePropertiesBasicResource + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointResourcePropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointResourcePropertiesBasicResource] = 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, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointResourcePropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointResourcePropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.EndpointResourcePropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_keys( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.EndpointKeys: + """List keys for the endpoint resource. + + List keys for the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: EndpointKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointKeys] = kwargs.pop("cls", None) + + _request = build_list_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_models( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterable["_models.EndpointModelProperties"]: + """Get available models under the endpoint resource. + + Get available models under the endpoint resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :return: An iterator like instance of either EndpointModelProperties or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.EndpointModelProperties] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointModels] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_get_models_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("EndpointModels", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @overload + def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: _models.RegenerateServiceAccountKeyContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + body: Union[_models.RegenerateServiceAccountKeyContent, IO[bytes]], + **kwargs: Any + ) -> _models.AccountApiKeys: + """Regenerate account keys. + + Regenerate account keys. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param body: Is either a RegenerateServiceAccountKeyContent type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateServiceAccountKeyContent or + IO[bytes] + :return: AccountApiKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.AccountApiKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.AccountApiKeys] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RegenerateServiceAccountKeyContent") + + _request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("AccountApiKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore 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 d65ee4225ec..64506709125 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +70,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -88,7 +91,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,7 +110,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +127,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +146,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -160,7 +163,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +183,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -235,7 +238,6 @@ 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 - :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: @@ -248,7 +250,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,19 +261,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -283,13 +283,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EnvironmentContainerResourceArmPaginatedResult", pipeline_response) @@ -299,11 +298,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,10 +315,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -335,12 +330,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -354,22 +348,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -380,11 +372,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/environments/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -401,12 +389,11 @@ def get( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -420,22 +407,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -445,16 +430,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -483,7 +464,6 @@ def create_or_update( :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: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -495,7 +475,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -512,11 +492,10 @@ def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -528,7 +507,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any ) -> _models.EnvironmentContainer: """Create or update container. @@ -543,17 +522,13 @@ def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Is either a EnvironmentContainer 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 + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO[bytes] :return: EnvironmentContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +551,7 @@ def create_or_update( else: _json = self._serialize.body(body, "EnvironmentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -585,16 +560,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -604,17 +577,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}" - } 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 fc163b0b3bb..0d0a33c1b73 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +59,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +78,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -96,7 +103,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,7 +123,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +140,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +160,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,7 +177,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -191,7 +198,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -204,6 +211,46 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_publish_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/environments/{name}/versions/{version}/publish", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 EnvironmentVersionsOperations: """ .. warning:: @@ -255,7 +302,6 @@ 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 - :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] @@ -267,7 +313,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -278,7 +324,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -288,12 +334,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -305,13 +349,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EnvironmentVersionResourceArmPaginatedResult", pipeline_response) @@ -321,11 +364,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -338,10 +381,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -359,12 +398,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,23 +416,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,11 +441,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/environments/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -428,12 +460,11 @@ def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,23 +478,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,16 +502,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -514,7 +539,6 @@ def create_or_update( :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: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -527,7 +551,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -546,11 +570,10 @@ def create_or_update( :param version: Version of EnvironmentVersion. Required. :type version: str :param body: Definition of EnvironmentVersion. Required. - :type body: IO + :type body: IO[bytes] :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: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -563,7 +586,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any ) -> _models.EnvironmentVersion: """Creates or updates an EnvironmentVersion. @@ -579,18 +602,14 @@ def create_or_update( :type name: str :param version: Version of EnvironmentVersion. Required. :type version: str - :param body: Definition of EnvironmentVersion. Is either a EnvironmentVersion 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 + :param body: Definition of EnvironmentVersion. Is either a EnvironmentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO[bytes] :return: EnvironmentVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -613,7 +632,7 @@ def create_or_update( else: _json = self._serialize.body(body, "EnvironmentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -623,16 +642,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -642,17 +659,232 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/environments/{name}/versions/{version}" - } + def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_features_operations.py new file mode 100644 index 00000000000..bee7e8b2acc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_features_operations.py @@ -0,0 +1,369 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, TypeVar, Union +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.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + featureset_name: str, + featureset_version: str, + subscription_id: str, + *, + skip: Optional[str] = None, + tags: Optional[str] = None, + feature_name: Optional[str] = None, + description: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 1000, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "featuresetName": _SERIALIZER.url( + "featureset_name", featureset_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + "featuresetVersion": _SERIALIZER.url("featureset_version", featureset_version, "str"), + } + + _url: str = _url.format(**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 tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if feature_name is not None: + _params["featureName"] = _SERIALIZER.query("feature_name", feature_name, "str") + if description is not None: + _params["description"] = _SERIALIZER.query("description", description, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + workspace_name: str, + featureset_name: str, + featureset_version: str, + feature_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{featuresetName}/versions/{featuresetVersion}/features/{featureName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "featuresetName": _SERIALIZER.url( + "featureset_name", featureset_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + "featuresetVersion": _SERIALIZER.url("featureset_version", featureset_version, "str"), + "featureName": _SERIALIZER.url( + "feature_name", feature_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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) + + +class FeaturesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`features` 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, + featureset_name: str, + featureset_version: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + feature_name: Optional[str] = None, + description: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 1000, + **kwargs: Any + ) -> Iterable["_models.Feature"]: + """List Features. + + List Features. + + :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 featureset_name: Featureset name. This is case-sensitive. Required. + :type featureset_name: str + :param featureset_version: Featureset Version identifier. This is case-sensitive. Required. + :type featureset_version: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param feature_name: feature name. Default value is None. + :type feature_name: str + :param description: Description of the featureset. Default value is None. + :type description: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: Page size. Default value is 1000. + :type page_size: int + :return: An iterator like instance of either Feature or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Feature] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeatureResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + featureset_name=featureset_name, + featureset_version=featureset_version, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + feature_name=feature_name, + description=description, + list_view_type=list_view_type, + page_size=page_size, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FeatureResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def get( + self, + resource_group_name: str, + workspace_name: str, + featureset_name: str, + featureset_version: str, + feature_name: str, + **kwargs: Any + ) -> _models.Feature: + """Get feature. + + Get feature. + + :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 featureset_name: Feature set name. This is case-sensitive. Required. + :type featureset_name: str + :param featureset_version: Feature set version identifier. This is case-sensitive. Required. + :type featureset_version: str + :param feature_name: Feature Name. This is case-sensitive. Required. + :type feature_name: str + :return: Feature or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Feature + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Feature] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + featureset_name=featureset_name, + featureset_version=featureset_version, + feature_name=feature_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("Feature", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_containers_operations.py new file mode 100644 index 00000000000..a1d3620427c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_containers_operations.py @@ -0,0 +1,764 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if description is not None: + _params["description"] = _SERIALIZER.query("description", description, "str") + if created_by is not None: + _params["createdBy"] = _SERIALIZER.query("created_by", created_by, "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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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_entity_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/featuresets/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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 FeaturesetContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`featureset_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, + workspace_name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FeaturesetContainer"]: + """List featurestore entity containers. + + List featurestore entity containers. + + :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 tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param name: name for the featureset. Default value is None. + :type name: str + :param description: description for the feature set. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :return: An iterator like instance of either FeaturesetContainer or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + name=name, + description=description, + created_by=created_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturesetContainerResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_entity( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.FeaturesetContainer: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :return: FeaturesetContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetContainer] = kwargs.pop("cls", None) + + _request = build_get_entity_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturesetContainer", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetContainer") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.FeaturesetContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturesetContainer, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FeaturesetContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Is either a FeaturesetContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetContainer or IO[bytes] + :return: An instance of LROPoller that returns either FeaturesetContainer or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetContainer] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetContainer", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FeaturesetContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_versions_operations.py new file mode 100644 index 00000000000..6fe6d0d1dd9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featureset_versions_operations.py @@ -0,0 +1,1082 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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 tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if version_name is not None: + _params["versionName"] = _SERIALIZER.query("version_name", version_name, "str") + 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 created_by is not None: + _params["createdBy"] = _SERIALIZER.query("created_by", created_by, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featuresets/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/featuresets/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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_backfill_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/featuresets/{name}/versions/{version}/backfill", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 FeaturesetVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`featureset_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, + workspace_name: str, + name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FeaturesetVersion"]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Featureset name. This is case-sensitive. Required. + :type name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param version_name: name for the featureset version. Default value is None. + :type version_name: str + :param version: featureset version. Default value is None. + :type version: str + :param description: description for the feature set version. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :param stage: Specifies the featurestore stage. Default value is None. + :type stage: str + :return: An iterator like instance of either FeaturesetVersion or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + name=name, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + version_name=version_name, + version=version, + description=description, + created_by=created_by, + stage=stage, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> _models.FeaturesetVersion: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :return: FeaturesetVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturesetVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturesetVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetVersion") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturesetVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersion, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Is either a FeaturesetVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersion or IO[bytes] + :return: An instance of LROPoller that returns either FeaturesetVersion or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetVersion] = 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, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersion", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FeaturesetVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _backfill_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturesetVersionBackfillRequest") + + _request = build_backfill_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturesetVersionBackfillRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetVersionBackfillResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturesetVersionBackfillResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_backfill( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturesetVersionBackfillRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FeaturesetVersionBackfillResponse]: + """Backfill. + + Backfill. + + :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 name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Feature set version backfill request entity. Is either a + FeaturesetVersionBackfillRequest type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillRequest or + IO[bytes] + :return: An instance of LROPoller that returns either FeaturesetVersionBackfillResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturesetVersionBackfillResponse] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturesetVersionBackfillResponse] = 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._backfill_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturesetVersionBackfillResponse", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturesetVersionBackfillResponse].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FeaturesetVersionBackfillResponse]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_containers_operations.py new file mode 100644 index 00000000000..8f2a3afe347 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_containers_operations.py @@ -0,0 +1,765 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if name is not None: + _params["name"] = _SERIALIZER.query("name", name, "str") + if description is not None: + _params["description"] = _SERIALIZER.query("description", description, "str") + if created_by is not None: + _params["createdBy"] = _SERIALIZER.query("created_by", created_by, "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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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_entity_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/featurestoreEntities/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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 FeaturestoreEntityContainersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`featurestore_entity_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, + workspace_name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + name: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FeaturestoreEntityContainer"]: + """List featurestore entity containers. + + List featurestore entity containers. + + :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 tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param name: name for the featurestore entity. Default value is None. + :type name: str + :param description: description for the featurestore entity. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :return: An iterator like instance of either FeaturestoreEntityContainer or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + name=name, + description=description, + created_by=created_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainerResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_entity( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.FeaturestoreEntityContainer: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :return: FeaturestoreEntityContainer or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityContainer] = kwargs.pop("cls", None) + + _request = build_get_entity_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturestoreEntityContainer", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturestoreEntityContainer") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.FeaturestoreEntityContainer, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturestoreEntityContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturestoreEntityContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.FeaturestoreEntityContainer, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityContainer]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param body: Container entity to create or update. Is either a FeaturestoreEntityContainer type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer or IO[bytes] + :return: An instance of LROPoller that returns either FeaturestoreEntityContainer or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityContainer] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturestoreEntityContainer] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityContainer", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturestoreEntityContainer].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FeaturestoreEntityContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_versions_operations.py new file mode 100644 index 00000000000..b217d433f7d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_featurestore_entity_versions_operations.py @@ -0,0 +1,809 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + name: str, + subscription_id: str, + *, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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 tags is not None: + _params["tags"] = _SERIALIZER.query("tags", tags, "str") + if list_view_type is not None: + _params["listViewType"] = _SERIALIZER.query("list_view_type", list_view_type, "str") + if page_size is not None: + _params["pageSize"] = _SERIALIZER.query("page_size", page_size, "int") + if version_name is not None: + _params["versionName"] = _SERIALIZER.query("version_name", version_name, "str") + 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 created_by is not None: + _params["createdBy"] = _SERIALIZER.query("created_by", created_by, "str") + if stage is not None: + _params["stage"] = _SERIALIZER.query("stage", stage, "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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/featurestoreEntities/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/featurestoreEntities/{name}/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 + ), + "workspaceName": _SERIALIZER.url( + "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 FeaturestoreEntityVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`featurestore_entity_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, + workspace_name: str, + name: str, + skip: Optional[str] = None, + tags: Optional[str] = None, + list_view_type: Optional[Union[str, _models.ListViewType]] = None, + page_size: int = 20, + version_name: Optional[str] = None, + version: Optional[str] = None, + description: Optional[str] = None, + created_by: Optional[str] = None, + stage: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.FeaturestoreEntityVersion"]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Feature entity name. This is case-sensitive. Required. + :type name: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: Comma-separated list of tag names (and optionally values). Example: + tag1,tag2=value2. Default value is None. + :type tags: str + :param list_view_type: [ListViewType.ActiveOnly, ListViewType.ArchivedOnly, + ListViewType.All]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 page_size: page size. Default value is 20. + :type page_size: int + :param version_name: name for the featurestore entity version. Default value is None. + :type version_name: str + :param version: featurestore entity version. Default value is None. + :type version: str + :param description: description for the feature entity version. Default value is None. + :type description: str + :param created_by: createdBy user name. Default value is None. + :type created_by: str + :param stage: Specifies the featurestore stage. Default value is None. + :type stage: str + :return: An iterator like instance of either FeaturestoreEntityVersion or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + name=name, + subscription_id=self._config.subscription_id, + skip=skip, + tags=tags, + list_view_type=list_view_type, + page_size=page_size, + version_name=version_name, + version=version, + description=description, + created_by=created_by, + stage=stage, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, 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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any + ) -> _models.FeaturestoreEntityVersion: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :return: FeaturestoreEntityVersion or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.FeaturestoreEntityVersion] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("FeaturestoreEntityVersion", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "FeaturestoreEntityVersion") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.FeaturestoreEntityVersion, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturestoreEntityVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either FeaturestoreEntityVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.FeaturestoreEntityVersion, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FeaturestoreEntityVersion]: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. This is case-sensitive. Required. + :type name: str + :param version: Version identifier. This is case-sensitive. Required. + :type version: str + :param body: Version entity to create or update. Is either a FeaturestoreEntityVersion type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion or IO[bytes] + :return: An instance of LROPoller that returns either FeaturestoreEntityVersion or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.FeaturestoreEntityVersion] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.FeaturestoreEntityVersion] = 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, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("FeaturestoreEntityVersion", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.FeaturestoreEntityVersion].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FeaturestoreEntityVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_endpoints_operations.py new file mode 100644 index 00000000000..006242d1a15 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_endpoints_operations.py @@ -0,0 +1,1005 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + pool_name: str, + subscription_id: str, + *, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if count is not None: + _params["count"] = _SERIALIZER.query("count", count, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "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 order_by is not None: + _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "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, + workspace_name: str, + pool_name: str, + endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, + pool_name: str, + endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, + workspace_name: str, + pool_name: str, + endpoint_name: str, + subscription_id: str, + *, + json: Any, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, json=json, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/endpoints/{endpointName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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 InferenceEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`inference_endpoints` 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, + pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> Iterable["_models.InferenceEndpoint"]: + """List Inference Endpoints. + + List Inference Endpoints. + + :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 pool_name: Name of the InferencePool. Required. + :type pool_name: str + :param count: Number of InferenceEndpoint to be retrieved in a page of results. Default value + is None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferenceEndpoint or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InferenceEndpointTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete InferenceEndpoint (asynchronous). + + Delete InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, pool_name: str, endpoint_name: str, **kwargs: Any + ) -> _models.InferenceEndpoint: + """Get InferenceEndpoint. + + Get InferenceEndpoint. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :return: InferenceEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceEndpoint] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferenceEndpoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _json = self._serialize.body(body, "object") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Any, + **kwargs: Any + ) -> LROPoller[_models.InferenceEndpoint]: + """Update InferenceEndpoint (asynchronous). + + Update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: any + :return: An instance of LROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.InferenceEndpoint] = 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, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferenceEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Union[_models.InferenceEndpoint, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferenceEndpoint") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: _models.InferenceEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + endpoint_name: str, + body: Union[_models.InferenceEndpoint, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.InferenceEndpoint]: + """Create or update InferenceEndpoint (asynchronous). + + Create or update InferenceEndpoint (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param endpoint_name: InferenceEndpoint name. Required. + :type endpoint_name: str + :param body: InferenceEndpoint entity to apply during operation. Is either a InferenceEndpoint + type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceEndpoint or IO[bytes] + :return: An instance of LROPoller that returns either InferenceEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceEndpoint] = 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, + pool_name=pool_name, + endpoint_name=endpoint_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferenceEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_groups_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_groups_operations.py new file mode 100644 index 00000000000..3b6d3da46a5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_groups_operations.py @@ -0,0 +1,1995 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + pool_name: str, + subscription_id: str, + *, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if count is not None: + _params["count"] = _SERIALIZER.query("count", count, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "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 order_by is not None: + _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "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, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/groups/{groupName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str"), + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/groups/{groupName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_get_delta_models_status_async_request( # pylint: disable=name-too-long + resource_group_name: str, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/groups/{groupName}/deltaModels/getStatus", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_delta_models_async_request( + resource_group_name: str, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/groups/{groupName}/deltaModels/list", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_modify_delta_models_async_request( + resource_group_name: str, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{poolName}/groups/{groupName}/deltaModels/modify", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_get_status_request( + resource_group_name: str, workspace_name: str, pool_name: str, group_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/getStatus", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_list_skus_request( + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + subscription_id: str, + *, + count: 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{poolName}/groups/{groupName}/skus", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "poolName": _SERIALIZER.url("pool_name", pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "groupName": _SERIALIZER.url("group_name", group_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if count is not None: + _params["count"] = _SERIALIZER.query("count", count, "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) + + +class InferenceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`inference_groups` 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, + pool_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> Iterable["_models.InferenceGroup"]: + """List Inference Groups. + + List Inference Groups. + + :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 pool_name: Name of the InferencePool. Required. + :type pool_name: str + :param count: Number of InferenceGroup to be retrieved in a page of results. Default value is + None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferenceGroup or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceGroupTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + pool_name=pool_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InferenceGroupTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete InferenceGroup (asynchronous). + + Delete InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> _models.InferenceGroup: + """Get InferenceGroup. + + Get InferenceGroup. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :return: InferenceGroup or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferenceGroup] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferenceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSku") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.PartialMinimalTrackedResourceWithSku, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Update InferenceGroup (asynchronous). + + Update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: Online Endpoint entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSku type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku or + IO[bytes] + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceGroup] = 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, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferenceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.InferenceGroup, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferenceGroup") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.InferenceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.InferenceGroup, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.InferenceGroup]: + """Create or update InferenceGroup (asynchronous). + + Create or update InferenceGroup (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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: InferenceGroup entity to apply during operation. Is either a InferenceGroup type + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferenceGroup or IO[bytes] + :return: An instance of LROPoller that returns either InferenceGroup or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferenceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferenceGroup] = 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, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferenceGroup", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferenceGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferenceGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelStatusRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_delta_models_status_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelStatusRequest, IO[bytes]], + **kwargs: Any + ) -> _models.DeltaModelStatusResponse: + """Retrieve status of delta models associated with the InferenceGroup and the target base model. + + Retrieve status of delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Is either a DeltaModelStatusRequest type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusRequest or IO[bytes] + :return: DeltaModelStatusResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.DeltaModelStatusResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.DeltaModelStatusResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelStatusRequest") + + _request = build_get_delta_models_status_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("DeltaModelStatusResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelListRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelListRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> Iterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def list_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelListRequest, IO[bytes]], + **kwargs: Any + ) -> Iterable[str]: + """List delta models associated with the InferenceGroup and the target base model. + + List delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelBaseRequest. Is either a DeltaModelListRequest type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelListRequest or IO[bytes] + :return: An iterator like instance of either str or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[str] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.StringArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelListRequest") + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_delta_models_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("StringArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _modify_delta_models_async_initial( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelModifyRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DeltaModelModifyRequest") + + _request = build_modify_delta_models_async_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: _models.DeltaModelModifyRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelModifyRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_modify_delta_models_async( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + body: Union[_models.DeltaModelModifyRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Modify delta models associated with the InferenceGroup and the target base model. + + Modify delta models associated with the InferenceGroup and the target base model. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :param body: DeltaModelModifyRequest. Is either a DeltaModelModifyRequest type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeltaModelModifyRequest or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._modify_delta_models_async_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get_status( + self, resource_group_name: str, workspace_name: str, pool_name: str, group_name: str, **kwargs: Any + ) -> _models.GroupStatus: + """Retrieve inference group status. + + Retrieve inference group status. + + :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 pool_name: InferencePool name. Required. + :type pool_name: str + :param group_name: InferenceGroup name. Required. + :type group_name: str + :return: GroupStatus or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GroupStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.GroupStatus] = kwargs.pop("cls", None) + + _request = build_get_status_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("GroupStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_skus( + self, + resource_group_name: str, + workspace_name: str, + pool_name: str, + group_name: str, + count: Optional[int] = None, + skip: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SkuResource"]: + """List Inference Group Skus. + + List Inference Group Skus. + + :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 pool_name: Inference Pool name. Required. + :type pool_name: str + :param group_name: Inference Group name. Required. + :type group_name: str + :param count: Number of Skus to be retrieved in a page of results. Default value is None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :return: An iterator like instance of either SkuResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.SkuResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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_skus_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + pool_name=pool_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + count=count, + skip=skip, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SkuResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_pools_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_pools_operations.py new file mode 100644 index 00000000000..b156878ddc8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_inference_pools_operations.py @@ -0,0 +1,1020 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + *, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if count is not None: + _params["count"] = _SERIALIZER.query("count", count, "int") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "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 order_by is not None: + _params["orderBy"] = _SERIALIZER.query("order_by", order_by, "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, workspace_name: str, inference_pool_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "inferencePoolName": _SERIALIZER.url( + "inference_pool_name", inference_pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, inference_pool_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/inferencePools/{inferencePoolName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "inferencePoolName": _SERIALIZER.url( + "inference_pool_name", inference_pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, workspace_name: str, inference_pool_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{inferencePoolName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "inferencePoolName": _SERIALIZER.url( + "inference_pool_name", inference_pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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, workspace_name: str, inference_pool_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/inferencePools/{inferencePoolName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "inferencePoolName": _SERIALIZER.url( + "inference_pool_name", inference_pool_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _url: str = _url.format(**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 InferencePoolsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`inference_pools` 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, + count: Optional[int] = None, + skip: Optional[str] = None, + tags: Optional[str] = None, + properties: Optional[str] = None, + order_by: Optional[Union[str, _models.OrderString]] = None, + **kwargs: Any + ) -> Iterable["_models.InferencePool"]: + """List InferencePools. + + List InferencePools. + + :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 count: Number of inferencePools to be retrieved in a page of results. Default value is + None. + :type count: int + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param tags: A set of tags with which to filter the returned models. It is a comma separated + string of tags key or tags key=value. Example: tagKey1,tagKey2,tagKey3=value3 . Default value + is None. + :type tags: str + :param properties: A set of properties with which to filter the returned models. It is a comma + separated string of properties key and/or properties key=value Example: + propKey1,propKey2,propKey3=value3 . Default value is None. + :type properties: str + :param order_by: The option to order the response. Known values are: "CreatedAtDesc", + "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. + :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString + :return: An iterator like instance of either InferencePool or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferencePoolTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + count=count, + skip=skip, + tags=tags, + properties=properties, + order_by=order_by, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("InferencePoolTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete InferencePool (asynchronous). + + Delete InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, inference_pool_name: str, **kwargs: Any + ) -> _models.InferencePool: + """Get InferencePool. + + Get InferencePool. + + :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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :return: InferencePool or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.InferencePool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.InferencePool] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("InferencePool", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSkuAndIdentity") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Update InferencePool (asynchronous). + + Update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: Inference Pool entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO[bytes] + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferencePool] = 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, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferencePool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferencePool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "InferencePool") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + inference_pool_name=inference_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: _models.InferencePool, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + inference_pool_name: str, + body: Union[_models.InferencePool, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.InferencePool]: + """Create or update InferencePool (asynchronous). + + Create or update InferencePool (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 inference_pool_name: Name of InferencePool. Required. + :type inference_pool_name: str + :param body: InferencePool entity to apply during operation. Is either a InferencePool type or + a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.InferencePool or IO[bytes] + :return: An instance of LROPoller that returns either InferencePool or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.InferencePool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.InferencePool] = 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, + inference_pool_name=inference_pool_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("InferencePool", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.InferencePool].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.InferencePool]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 83dc12a1ff0..bfbad478526 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,12 +53,13 @@ def build_list_request( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + properties: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +77,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,6 +89,8 @@ 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 properties is not None: + _params["properties"] = _SERIALIZER.query("properties", properties, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -96,7 +104,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +123,7 @@ def build_delete_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +140,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -151,7 +159,7 @@ def build_get_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -168,7 +176,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +196,7 @@ def build_create_or_update_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +215,7 @@ def build_cancel_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -226,7 +234,7 @@ def build_cancel_request( "id": _SERIALIZER.url("id", id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -265,6 +273,7 @@ def list( job_type: Optional[str] = None, tag: Optional[str] = None, list_view_type: Optional[Union[str, _models.ListViewType]] = None, + properties: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.JobBase"]: """Lists Jobs in the workspace. @@ -285,7 +294,9 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response + :param properties: Comma-separated list of user property names (and optionally values). + Example: prop1,prop2=value2. Default value is None. + :type properties: str :return: An iterator like instance of either JobBase or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.JobBase] :raises ~azure.core.exceptions.HttpResponseError: @@ -296,7 +307,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,7 +318,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -315,13 +326,12 @@ def prepare_request(next_link=None): job_type=job_type, tag=tag, list_view_type=list_view_type, + properties=properties, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -333,13 +343,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("JobBaseResourceArmPaginatedResult", pipeline_response) @@ -349,11 +358,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,14 +375,8 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -385,29 +388,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -420,12 +426,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> LROPoller[None]: @@ -440,14 +446,6 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, id: str, * :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. 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: @@ -461,7 +459,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, id: str, * 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -471,11 +469,12 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, id: str, * params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -486,17 +485,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/jobs/{id}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> _models.JobBase: @@ -511,12 +506,11 @@ def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -530,22 +524,20 @@ def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.JobBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_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.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -555,16 +547,12 @@ def get(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("JobBase", pipeline_response) + deserialized = self._deserialize("JobBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -578,8 +566,10 @@ def create_or_update( **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -593,7 +583,6 @@ def create_or_update( :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: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: @@ -605,14 +594,16 @@ def create_or_update( resource_group_name: str, workspace_name: str, id: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -622,11 +613,10 @@ def create_or_update( :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str :param body: Job definition object. Required. - :type body: IO + :type body: IO[bytes] :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: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: @@ -634,11 +624,18 @@ def create_or_update( @distributed_trace def create_or_update( - self, resource_group_name: str, workspace_name: str, id: str, body: Union[_models.JobBase, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + id: str, + body: Union[_models.JobBase, IO[bytes]], + **kwargs: Any ) -> _models.JobBase: """Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. Creates and executes a Job. + For update case, the Tags in the definition passed in will replace Tags in the existing job. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -647,17 +644,13 @@ def create_or_update( :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. Required. :type id: str - :param body: Job definition object. Is either a JobBase type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.JobBase 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 + :param body: Job definition object. Is either a JobBase type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.JobBase or IO[bytes] :return: JobBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.JobBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -680,7 +673,7 @@ def create_or_update( else: _json = self._serialize.body(body, "JobBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -689,16 +682,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,25 +699,15 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("JobBase", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("JobBase", pipeline_response) + deserialized = self._deserialize("JobBase", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}" - } - - def _cancel_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any - ) -> None: - error_map = { + def _cancel_initial(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -738,29 +719,32 @@ def _cancel_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_cancel_request( + _request = build_cancel_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._cancel_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -770,12 +754,12 @@ def _cancel_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _cancel_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel" - } + return deserialized # type: ignore @distributed_trace def begin_cancel(self, resource_group_name: str, workspace_name: str, id: str, **kwargs: Any) -> LROPoller[None]: @@ -790,14 +774,6 @@ def begin_cancel(self, resource_group_name: str, workspace_name: str, id: str, * :type workspace_name: str :param id: The name and identifier for the Job. This is case-sensitive. 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: @@ -811,7 +787,7 @@ def begin_cancel(self, resource_group_name: str, workspace_name: str, id: str, * 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._cancel_initial( # type: ignore + raw_result = self._cancel_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, id=id, @@ -821,11 +797,12 @@ def begin_cancel(self, resource_group_name: str, workspace_name: str, id: str, * params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -836,14 +813,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_cancel.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/jobs/{id}/cancel" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_provisions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_provisions_operations.py new file mode 100644 index 00000000000..c76ef7a58f0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_provisions_operations.py @@ -0,0 +1,315 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_provision_managed_network_request( + resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/provisionManagedNetwork", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 ManagedNetworkProvisionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`managed_network_provisions` 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") + + def _provision_managed_network_initial( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[Union[_models.ManagedNetworkProvisionOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "ManagedNetworkProvisionOptions") + else: + _json = None + + _request = build_provision_managed_network_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[_models.ManagedNetworkProvisionOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Default + value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Default + value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_provision_managed_network( + self, + resource_group_name: str, + workspace_name: str, + body: Optional[Union[_models.ManagedNetworkProvisionOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.ManagedNetworkProvisionStatus]: + """Provisions the managed network of a machine learning workspace. + + Provisions the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: Managed Network Provisioning Options for a machine learning workspace. Is either a + ManagedNetworkProvisionOptions type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionOptions or + IO[bytes] + :return: An instance of LROPoller that returns either ManagedNetworkProvisionStatus or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ManagedNetworkProvisionStatus] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ManagedNetworkProvisionStatus] = 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._provision_managed_network_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ManagedNetworkProvisionStatus", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ManagedNetworkProvisionStatus].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ManagedNetworkProvisionStatus]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_settings_rule_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_settings_rule_operations.py new file mode 100644 index 00000000000..fc9abad6044 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_managed_network_settings_rule_operations.py @@ -0,0 +1,703 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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_delete_request( + resource_group_name: str, workspace_name: str, rule_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$"), + } + + _url: str = _url.format(**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, rule_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundRules/{ruleName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$"), + } + + _url: str = _url.format(**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, workspace_name: str, rule_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/outboundRules/{ruleName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "ruleName": _SERIALIZER.url("rule_name", rule_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$"), + } + + _url: str = _url.format(**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 ManagedNetworkSettingsRuleOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`managed_network_settings_rule` 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, **kwargs: Any + ) -> Iterable["_models.OutboundRuleBasicResource"]: + """Lists the managed network outbound rules for a machine learning workspace. + + Lists the managed network outbound rules for a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: An iterator like instance of either OutboundRuleBasicResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundRuleListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OutboundRuleListResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an outbound rule from the managed network of a machine learning workspace. + + Deletes an outbound rule from the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, rule_name: str, **kwargs: Any + ) -> _models.OutboundRuleBasicResource: + """Gets an outbound rule from the managed network of a machine learning workspace. + + Gets an outbound rule from the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :return: OutboundRuleBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OutboundRuleBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("OutboundRuleBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "OutboundRuleBasicResource") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: _models.OutboundRuleBasicResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OutboundRuleBasicResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either OutboundRuleBasicResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + body: Union[_models.OutboundRuleBasicResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.OutboundRuleBasicResource]: + """Creates or updates an outbound rule in the managed network of a machine learning workspace. + + Creates or updates an outbound rule in the managed network of a machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param rule_name: Name of the workspace managed network outbound rule. Required. + :type rule_name: str + :param body: Outbound Rule to be created or updated in the managed network of a machine + learning workspace. Is either a OutboundRuleBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource or IO[bytes] + :return: An instance of LROPoller that returns either OutboundRuleBasicResource or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.OutboundRuleBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.OutboundRuleBasicResource] = 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, + rule_name=rule_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("OutboundRuleBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.OutboundRuleBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.OutboundRuleBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_marketplace_subscriptions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_marketplace_subscriptions_operations.py new file mode 100644 index 00000000000..2151313593b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_marketplace_subscriptions_operations.py @@ -0,0 +1,711 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/marketplaceSubscriptions/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/marketplaceSubscriptions/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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 MarketplaceSubscriptionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`marketplace_subscriptions` 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, **kwargs: Any + ) -> Iterable["_models.MarketplaceSubscription"]: + """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 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 + :return: An iterator like instance of either MarketplaceSubscription or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceSubscriptionResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscriptionResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete Marketplace Subscription (asynchronous). + + Delete Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.MarketplaceSubscription: + """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 workspace_name: Name of Azure Machine Learning workspace. Required. + :type workspace_name: str + :param name: Container name. Required. + :type name: str + :return: MarketplaceSubscription or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.MarketplaceSubscription] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("MarketplaceSubscription", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "MarketplaceSubscription") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.MarketplaceSubscription, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MarketplaceSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either MarketplaceSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.MarketplaceSubscription, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MarketplaceSubscription]: + """Create or update Marketplace Subscription (asynchronous). + + Create or update Marketplace Subscription (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 name: Marketplace Subscription name. Required. + :type name: str + :param body: Marketplace Subscription entity to apply during operation. Is either a + MarketplaceSubscription type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.MarketplaceSubscription or IO[bytes] + :return: An instance of LROPoller that returns either MarketplaceSubscription or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.MarketplaceSubscription] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.MarketplaceSubscription] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("MarketplaceSubscription", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.MarketplaceSubscription].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MarketplaceSubscription]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 bdc20a437ab..5e01c04eb06 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +71,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,7 +94,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +113,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -127,7 +130,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +149,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -163,7 +166,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -183,7 +186,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -241,7 +244,6 @@ 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 - :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: @@ -252,7 +254,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -263,7 +265,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -271,12 +273,10 @@ def prepare_request(next_link=None): count=count, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -288,13 +288,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ModelContainerResourceArmPaginatedResult", pipeline_response) @@ -304,11 +303,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,10 +320,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any @@ -340,12 +335,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,22 +353,20 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -385,11 +377,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/models/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.ModelContainer: @@ -404,12 +392,11 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,22 +410,20 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,16 +433,12 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -486,7 +467,6 @@ def create_or_update( :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: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -498,7 +478,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -515,11 +495,10 @@ def create_or_update( :param name: Container name. This is case-sensitive. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: @@ -531,7 +510,7 @@ def create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any ) -> _models.ModelContainer: """Create or update container. @@ -545,18 +524,14 @@ def create_or_update( :type workspace_name: str :param name: Container name. This is case-sensitive. Required. :type name: str - :param body: Container entity to create or update. Is either a ModelContainer 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 + :param body: Container entity to create or update. Is either a ModelContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO[bytes] :return: ModelContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,7 +554,7 @@ def create_or_update( else: _json = self._serialize.body(body, "ModelContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -588,16 +563,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -607,17 +580,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ModelContainer", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}" - } 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 94082df9834..fd505f15342 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +65,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +84,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,7 +121,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +141,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -151,7 +158,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +178,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -188,7 +195,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +216,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,6 +229,46 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) +def build_publish_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/models/{name}/versions/{version}/publish", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 ModelVersionsOperations: """ .. warning:: @@ -293,7 +340,6 @@ 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 - :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: @@ -304,7 +350,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,7 +361,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -331,12 +377,10 @@ def prepare_request(next_link=None): feed=feed, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -348,13 +392,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ModelVersionResourceArmPaginatedResult", pipeline_response) @@ -364,11 +407,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -381,10 +424,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions" - } - @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, name: str, version: str, **kwargs: Any @@ -402,12 +441,11 @@ def delete( # pylint: disable=inconsistent-return-statements :type 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: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -421,23 +459,21 @@ def delete( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, version=version, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -448,11 +484,7 @@ def delete( # pylint: disable=inconsistent-return-statements 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}/models/{name}/versions/{version}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -471,12 +503,11 @@ def get( :type 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -490,23 +521,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -516,16 +545,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -557,7 +582,6 @@ def create_or_update( :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: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +594,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -589,11 +613,10 @@ def create_or_update( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: @@ -606,7 +629,7 @@ def create_or_update( workspace_name: str, name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any ) -> _models.ModelVersion: """Create or update version. @@ -622,18 +645,14 @@ def create_or_update( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Version entity to create or update. Is either a ModelVersion 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 + :param body: Version entity to create or update. Is either a ModelVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO[bytes] :return: ModelVersion or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ModelVersion :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +675,7 @@ def create_or_update( else: _json = self._serialize.body(body, "ModelVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -666,16 +685,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -685,17 +702,232 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ModelVersion", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/models/{name}/versions/{version}" - } + def _publish_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "DestinationAsset") + + _request = build_publish_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: _models.DestinationAsset, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace + def begin_publish( + self, + resource_group_name: str, + workspace_name: str, + name: str, + version: str, + body: Union[_models.DestinationAsset, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Publish version asset into registry. + + Publish version asset into registry. + + :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 name: Container name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Destination registry info. Is either a DestinationAsset type or a IO[bytes] type. + Required. + :type body: ~azure.mgmt.machinelearningservices.models.DestinationAsset or IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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) + 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._publish_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + version=version, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 618d15662d9..f21d61a8e46 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +77,7 @@ def build_list_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,7 +105,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +125,7 @@ def build_delete_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,7 +147,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -162,7 +167,7 @@ def build_get_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +189,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -209,7 +214,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -233,7 +238,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -258,7 +263,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -282,7 +287,7 @@ def build_get_logs_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -303,7 +308,7 @@ def build_get_logs_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -330,7 +335,7 @@ def build_list_skus_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -350,7 +355,7 @@ def build_list_skus_request( "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -412,7 +417,6 @@ def list( :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 OnlineDeployment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.OnlineDeployment] @@ -424,7 +428,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineDeploymentTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -435,7 +439,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -444,12 +448,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -461,13 +463,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OnlineDeploymentTrackedResourceArmPaginatedResult", pipeline_response) @@ -477,11 +478,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,14 +495,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, deployment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,30 +510,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -549,12 +549,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -573,14 +573,6 @@ def begin_delete( :type endpoint_name: str :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_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: @@ -594,7 +586,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -605,11 +597,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -620,17 +613,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -649,12 +638,11 @@ def get( :type endpoint_name: str :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OnlineDeployment or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.OnlineDeployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -668,23 +656,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineDeployment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, deployment_name=deployment_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -694,16 +680,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore def _update_initial( self, @@ -711,10 +693,10 @@ def _update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnlineDeployment]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -727,7 +709,7 @@ def _update_initial( api_version: str = 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.OnlineDeployment]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -737,7 +719,7 @@ def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSku") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -747,30 +729,29 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineDeployment", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -778,14 +759,12 @@ def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -817,14 +796,6 @@ def begin_update( :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 OnlineDeployment or the result of cls(response) :rtype: @@ -839,7 +810,7 @@ def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -858,18 +829,10 @@ def begin_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineDeployment or the result of cls(response) :rtype: @@ -884,7 +847,7 @@ def begin_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithSku, IO], + body: Union[_models.PartialMinimalTrackedResourceWithSku, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OnlineDeployment]: """Update Online Deployment (asynchronous). @@ -901,20 +864,9 @@ def begin_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Online Endpoint entity to apply during operation. Is either a - PartialMinimalTrackedResourceWithSku type or a IO type. Required. + PartialMinimalTrackedResourceWithSku type or a IO[bytes] type. Required. :type body: ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSku 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. + IO[bytes] :return: An instance of LROPoller that returns either OnlineDeployment or the result of cls(response) :rtype: @@ -944,12 +896,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -959,17 +912,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OnlineDeployment].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[_models.OnlineDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _create_or_update_initial( self, @@ -977,10 +928,10 @@ def _create_or_update_initial( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.OnlineDeployment, IO], + body: Union[_models.OnlineDeployment, IO[bytes]], **kwargs: Any - ) -> _models.OnlineDeployment: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +944,7 @@ def _create_or_update_initial( api_version: str = 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.OnlineDeployment] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1003,7 +954,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "OnlineDeployment") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1013,29 +964,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineDeployment", 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") @@ -1044,17 +995,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } - @overload def begin_create_or_update( self, @@ -1085,14 +1032,6 @@ def begin_create_or_update( :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 OnlineDeployment or the result of cls(response) :rtype: @@ -1107,7 +1046,7 @@ def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1126,18 +1065,10 @@ def begin_create_or_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Inference Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineDeployment or the result of cls(response) :rtype: @@ -1152,7 +1083,7 @@ def begin_create_or_update( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.OnlineDeployment, IO], + body: Union[_models.OnlineDeployment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OnlineDeployment]: """Create or update Inference Endpoint Deployment (asynchronous). @@ -1169,19 +1100,8 @@ def begin_create_or_update( :param deployment_name: Inference Endpoint Deployment name. Required. :type deployment_name: str :param body: Inference Endpoint entity to apply during operation. Is either a OnlineDeployment - type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.OnlineDeployment 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. + type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OnlineDeployment or IO[bytes] :return: An instance of LROPoller that returns either OnlineDeployment or the result of cls(response) :rtype: @@ -1211,12 +1131,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineDeployment", pipeline_response) + deserialized = self._deserialize("OnlineDeployment", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1228,17 +1149,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OnlineDeployment].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}/onlineEndpoints/{endpointName}/deployments/{deploymentName}" - } + return LROPoller[_models.OnlineDeployment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def get_logs( @@ -1270,7 +1189,6 @@ def get_logs( :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: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: @@ -1283,7 +1201,7 @@ def get_logs( workspace_name: str, endpoint_name: str, deployment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1302,11 +1220,10 @@ def get_logs( :param deployment_name: The name and identifier for the endpoint. Required. :type deployment_name: str :param body: The request containing parameters for retrieving logs. Required. - :type body: IO + :type body: IO[bytes] :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: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: @@ -1319,7 +1236,7 @@ def get_logs( workspace_name: str, endpoint_name: str, deployment_name: str, - body: Union[_models.DeploymentLogsRequest, IO], + body: Union[_models.DeploymentLogsRequest, IO[bytes]], **kwargs: Any ) -> _models.DeploymentLogs: """Polls an Endpoint operation. @@ -1336,17 +1253,13 @@ def get_logs( :param deployment_name: The name and identifier for the endpoint. Required. :type deployment_name: str :param body: The request containing parameters for retrieving logs. Is either a - DeploymentLogsRequest type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.DeploymentLogsRequest 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 + DeploymentLogsRequest type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DeploymentLogsRequest or IO[bytes] :return: DeploymentLogs or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DeploymentLogs :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1369,7 +1282,7 @@ def get_logs( else: _json = self._serialize.body(body, "DeploymentLogsRequest") - request = build_get_logs_request( + _request = build_get_logs_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1379,16 +1292,14 @@ def get_logs( content_type=content_type, json=_json, content=_content, - template_url=self.get_logs.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1398,16 +1309,12 @@ def get_logs( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeploymentLogs", pipeline_response) + deserialized = self._deserialize("DeploymentLogs", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_logs.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/getLogs" - } + return deserialized # type: ignore @distributed_trace def list_skus( @@ -1437,7 +1344,6 @@ def list_skus( :type count: 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 SkuResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.SkuResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -1448,7 +1354,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SkuResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1459,7 +1365,7 @@ def list_skus( def prepare_request(next_link=None): if not next_link: - request = build_list_skus_request( + _request = build_list_skus_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1468,12 +1374,10 @@ def prepare_request(next_link=None): count=count, skip=skip, api_version=api_version, - template_url=self.list_skus.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1485,13 +1389,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SkuResourceArmPaginatedResult", pipeline_response) @@ -1501,11 +1404,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1517,7 +1420,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_skus.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/deployments/{deploymentName}/skus" - } 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 6fbb1609216..3bc7a089dbf 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +110,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +129,7 @@ def build_delete_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -141,7 +146,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +165,7 @@ def build_get_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,7 +182,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +202,7 @@ def build_update_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,7 +221,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -238,7 +243,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -257,7 +262,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +281,7 @@ def build_list_keys_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -293,7 +298,7 @@ def build_regenerate_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -313,7 +318,7 @@ def build_regenerate_keys_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -332,7 +337,7 @@ def build_get_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -351,7 +356,7 @@ def build_get_token_request( "endpointName": _SERIALIZER.url("endpoint_name", endpoint_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -424,7 +429,6 @@ def list( :param order_by: The option to order the response. Known values are: "CreatedAtDesc", "CreatedAtAsc", "UpdatedAtDesc", and "UpdatedAtAsc". Default value is None. :type order_by: str or ~azure.mgmt.machinelearningservices.models.OrderString - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OnlineEndpoint or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.OnlineEndpoint] :raises ~azure.core.exceptions.HttpResponseError: @@ -435,7 +439,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -446,7 +450,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -458,12 +462,10 @@ def prepare_request(next_link=None): properties=properties, order_by=order_by, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -475,13 +477,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OnlineEndpointTrackedResourceArmPaginatedResult", pipeline_response) @@ -491,11 +492,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -508,14 +509,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -527,29 +524,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -562,12 +562,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -584,14 +584,6 @@ def begin_delete( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_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: @@ -605,7 +597,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -615,11 +607,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -630,17 +623,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -657,12 +646,11 @@ def get( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OnlineEndpoint or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -676,22 +664,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OnlineEndpoint] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -701,26 +687,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore def _update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnlineEndpoint]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -733,7 +715,7 @@ def _update_initial( api_version: str = 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.OnlineEndpoint]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -743,7 +725,7 @@ def _update_initial( else: _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithIdentity") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -752,30 +734,29 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineEndpoint", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -783,14 +764,12 @@ def _update_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -820,14 +799,6 @@ def begin_update( :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -841,7 +812,7 @@ def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -858,18 +829,10 @@ def begin_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -883,7 +846,7 @@ def begin_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO], + body: Union[_models.PartialMinimalTrackedResourceWithIdentity, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OnlineEndpoint]: """Update Online Endpoint (asynchronous). @@ -898,20 +861,10 @@ def begin_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Is either a - PartialMinimalTrackedResourceWithIdentity type or a IO type. Required. + PartialMinimalTrackedResourceWithIdentity type or a IO[bytes] type. Required. :type body: - ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity 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. + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithIdentity or + IO[bytes] :return: An instance of LROPoller that returns either OnlineEndpoint or the result of cls(response) :rtype: @@ -940,12 +893,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -955,27 +909,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OnlineEndpoint].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/workspaces/{workspaceName}/onlineEndpoints/{endpointName}" - } + return LROPoller[_models.OnlineEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _create_or_update_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.OnlineEndpoint, IO], + body: Union[_models.OnlineEndpoint, IO[bytes]], **kwargs: Any - ) -> _models.OnlineEndpoint: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -988,7 +940,7 @@ def _create_or_update_initial( api_version: str = 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.OnlineEndpoint] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -998,7 +950,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "OnlineEndpoint") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1007,29 +959,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("OnlineEndpoint", 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") @@ -1038,17 +990,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/onlineEndpoints/{endpointName}" - } - @overload def begin_create_or_update( self, @@ -1076,14 +1024,6 @@ def begin_create_or_update( :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -1097,7 +1037,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1114,18 +1054,10 @@ def begin_create_or_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Required. - :type body: IO + :type body: IO[bytes] :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 OnlineEndpoint or the result of cls(response) :rtype: @@ -1139,7 +1071,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.OnlineEndpoint, IO], + body: Union[_models.OnlineEndpoint, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.OnlineEndpoint]: """Create or update Online Endpoint (asynchronous). @@ -1154,19 +1086,8 @@ def begin_create_or_update( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: Online Endpoint entity to apply during operation. Is either a OnlineEndpoint type - or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint 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. + or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.OnlineEndpoint or IO[bytes] :return: An instance of LROPoller that returns either OnlineEndpoint or the result of cls(response) :rtype: @@ -1195,12 +1116,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("OnlineEndpoint", pipeline_response) + deserialized = self._deserialize("OnlineEndpoint", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1212,17 +1134,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OnlineEndpoint].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}/onlineEndpoints/{endpointName}" - } + return LROPoller[_models.OnlineEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_keys( @@ -1239,12 +1159,11 @@ def list_keys( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthKeys or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1258,22 +1177,20 @@ def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1283,26 +1200,22 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthKeys", pipeline_response) + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/listKeys" - } + return deserialized # type: ignore - def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements + def _regenerate_keys_initial( self, resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.RegenerateEndpointKeysRequest, IO], + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1315,7 +1228,7 @@ def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1325,7 +1238,7 @@ def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(body, "RegenerateEndpointKeysRequest") - request = build_regenerate_keys_request( + _request = build_regenerate_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1334,21 +1247,24 @@ def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._regenerate_keys_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -1358,12 +1274,12 @@ def _regenerate_keys_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _regenerate_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys" - } + return deserialized # type: ignore @overload def begin_regenerate_keys( @@ -1392,14 +1308,6 @@ def begin_regenerate_keys( :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1411,7 +1319,7 @@ def begin_regenerate_keys( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1428,18 +1336,10 @@ def begin_regenerate_keys( :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str :param body: RegenerateKeys request . Required. - :type body: IO + :type body: IO[bytes] :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 None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1451,7 +1351,7 @@ def begin_regenerate_keys( resource_group_name: str, workspace_name: str, endpoint_name: str, - body: Union[_models.RegenerateEndpointKeysRequest, IO], + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], **kwargs: Any ) -> LROPoller[None]: """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). @@ -1465,20 +1365,10 @@ def begin_regenerate_keys( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest 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. + :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest or + IO[bytes] :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: @@ -1493,7 +1383,7 @@ def begin_regenerate_keys( 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._regenerate_keys_initial( # type: ignore + raw_result = self._regenerate_keys_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, @@ -1505,11 +1395,12 @@ def begin_regenerate_keys( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -1520,17 +1411,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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_regenerate_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/regenerateKeys" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get_token( @@ -1547,12 +1434,11 @@ def get_token( :type workspace_name: str :param endpoint_name: Online Endpoint name. Required. :type endpoint_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: EndpointAuthToken or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthToken :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1566,22 +1452,20 @@ def get_token( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EndpointAuthToken] = kwargs.pop("cls", None) - request = build_get_token_request( + _request = build_get_token_request( resource_group_name=resource_group_name, workspace_name=workspace_name, endpoint_name=endpoint_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1591,13 +1475,9 @@ def get_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EndpointAuthToken", pipeline_response) + deserialized = self._deserialize("EndpointAuthToken", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/onlineEndpoints/{endpointName}/token" - } + return deserialized # type: ignore 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 7dbac1fe15f..2c2e4917bd6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,21 +78,22 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.AmlOperation"]: + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available Azure Machine Learning Workspaces 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) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AmlOperation] + Lists all of the available Azure Machine Learning Workspaces REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AmlOperationListResult] = kwargs.pop("cls", None) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +104,12 @@ def list(self, **kwargs: Any) -> Iterable["_models.AmlOperation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,27 +121,26 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("AmlOperationListResult", pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +152,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.MachineLearningServices/operations"} 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 a5d73b4be94..a30f7ba9044 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,16 +55,16 @@ def build_list_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections", ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +75,7 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( +def build_delete_request( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, @@ -82,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +106,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,10 +114,10 @@ def build_get_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( +def build_get_request( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, @@ -124,8 +127,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,20 +148,18 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_create_or_update_request( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, @@ -169,7 +169,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -190,15 +191,17 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) class PrivateEndpointConnectionsOperations: @@ -224,14 +227,15 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, workspace_name: str, **kwargs: Any ) -> Iterable["_models.PrivateEndpointConnection"]: - """List all the private endpoint connections associated with the workspace. + """Called by end-users to get all PE connections. + + Called by end-users to get all PE connections. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -244,7 +248,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -255,17 +259,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -277,13 +279,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -293,11 +294,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -310,30 +311,85 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections" - } + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> None: + """Called by end-users to delete a PE connection. + + Called by end-users to delete a PE connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. + :type private_endpoint_connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore @distributed_trace def get( self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the workspace. + """Called by end-users to get a PE connection. + + Called by end-users to get a PE connection. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -347,22 +403,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,16 +426,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore @overload def create_or_update( @@ -389,27 +439,29 @@ def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: _models.PrivateEndpointConnection, + body: _models.PrivateEndpointConnection, *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection + :param body: PrivateEndpointConnection object. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :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: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -421,27 +473,29 @@ def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Required. - :type properties: IO + :param body: PrivateEndpointConnection object. Required. + :type body: IO[bytes] :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: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -453,31 +507,30 @@ def create_or_update( resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + body: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Update the state of specified private endpoint connection associated with the workspace. + """Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. + + Called by end-users to approve or reject a PE connection. + This method must validate and forward the call to NRP. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. + :param private_endpoint_connection_name: NRP Private Endpoint Connection Name. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type properties: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection 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 + :param body: PrivateEndpointConnection object. Is either a PrivateEndpointConnection type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection or IO[bytes] :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -495,12 +548,12 @@ def create_or_update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(properties, "PrivateEndpointConnection") + _json = self._serialize.body(body, "PrivateEndpointConnection") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -509,16 +562,14 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -528,78 +579,9 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> None: - """Deletes the specified private endpoint connection associated with 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 private_endpoint_connection_name: The name of the private endpoint connection associated - with the workspace. Required. - :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - 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: str = 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, - private_endpoint_connection_name=private_endpoint_connection_name, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore 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 a262b6f295c..30c02f472a0 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,17 +18,20 @@ 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.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -58,7 +63,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -91,64 +96,98 @@ def __init__(self, *args, **kwargs): @distributed_trace def list( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.PrivateLinkResourceListResult: - """Gets the private link resources that need to be created for a workspace. + ) -> Iterable["_models.PrivateLinkResource"]: + """Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". + + Called by Client (Portal, CLI, etc) to get available "private link resources" for the + workspace. + Each "private link resource" is a connection endpoint (IP address) to the resource. + Pre single connection endpoint per workspace: the Data Plane IP address, returned by DNS + resolution. + Other RPs, such as Azure Storage, have multiple - one for Blobs, other for Queues, etc. + Defined in the "[NRP] Private Endpoint Design" doc, topic "GET API for GroupIds". :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.PrivateLinkResourceListResult + :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.PrivateLinkResource] :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - 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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("PrivateLinkResourceListResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/privateLinkResources" - } + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) 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 1896a7522c0..def784313f4 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -20,16 +21,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +44,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -55,7 +58,7 @@ def build_update_request(location: str, subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,7 +75,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +88,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +136,6 @@ def update( :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: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: @@ -141,18 +143,17 @@ def update( @overload def update( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.UpdateWorkspaceQuotasResult: """Update quota for each VM family in workspace. :param location: The location for update quota is queried. Required. :type location: str :param parameters: Quota update parameters. Required. - :type parameters: IO + :type parameters: IO[bytes] :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: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: @@ -160,24 +161,20 @@ def update( @distributed_trace def update( - self, location: str, parameters: Union[_models.QuotaUpdateParameters, IO], **kwargs: Any + self, location: str, parameters: Union[_models.QuotaUpdateParameters, IO[bytes]], **kwargs: Any ) -> _models.UpdateWorkspaceQuotasResult: """Update quota for each VM family in workspace. :param location: The location for update quota is queried. Required. :type location: str - :param parameters: Quota update parameters. Is either a QuotaUpdateParameters type or a IO - type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.QuotaUpdateParameters 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 + :param parameters: Quota update parameters. Is either a QuotaUpdateParameters type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.machinelearningservices.models.QuotaUpdateParameters or IO[bytes] :return: UpdateWorkspaceQuotasResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.UpdateWorkspaceQuotasResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -200,23 +197,21 @@ def update( else: _json = self._serialize.body(parameters, "QuotaUpdateParameters") - request = build_update_request( + _request = build_update_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,16 +221,12 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("UpdateWorkspaceQuotasResult", pipeline_response) + deserialized = self._deserialize("UpdateWorkspaceQuotasResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/updateQuotas" - } + return deserialized # type: ignore @distributed_trace def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceQuota"]: @@ -243,7 +234,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceQuota" :param location: The location for which resource usage is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceQuota or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ResourceQuota] :raises ~azure.core.exceptions.HttpResponseError: @@ -254,7 +244,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceQuota" api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListWorkspaceQuotas] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -265,16 +255,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.ResourceQuota" def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -286,13 +274,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ListWorkspaceQuotas", pipeline_response) @@ -302,11 +289,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,7 +305,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/quotas" - } diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policies_operations.py new file mode 100644 index 00000000000..80dccf9e550 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policies_operations.py @@ -0,0 +1,204 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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, Iterable, Optional, Type, TypeVar +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.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, + endpoint_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class RaiPoliciesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`rai_policies` 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, + endpoint_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RaiPolicyPropertiesBasicResource"]: + """List the specified Content Filters associated with the Azure OpenAI account. + + List the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An iterator like instance of either RaiPolicyPropertiesBasicResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + endpoint_name=endpoint_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policy_operations.py new file mode 100644 index 00000000000..808def92559 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_rai_policy_operations.py @@ -0,0 +1,656 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_delete_request( + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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, + endpoint_name: str, + rai_policy_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**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_request( + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + subscription_id: str, + *, + proxy_api_version: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/endpoints/{endpointName}/raiPolicies/{raiPolicyName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "endpointName": _SERIALIZER.url( + "endpoint_name", endpoint_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,32}$" + ), + "raiPolicyName": _SERIALIZER.url( + "rai_policy_name", rai_policy_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if proxy_api_version is not None: + _params["proxy-api-version"] = _SERIALIZER.query("proxy_api_version", proxy_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 RaiPolicyOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`rai_policy` 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") + + def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified Content Filters associated with the Azure OpenAI account. + + Deletes the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + proxy_api_version=proxy_api_version, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, endpoint_name: str, rai_policy_name: str, **kwargs: Any + ) -> _models.RaiPolicyPropertiesBasicResource: + """Gets the specified Content Filters associated with the Azure OpenAI account. + + Gets the specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :return: RaiPolicyPropertiesBasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RaiPolicyPropertiesBasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RaiPolicyPropertiesBasicResource") + + _request = build_create_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + subscription_id=self._config.subscription_id, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: _models.RaiPolicyPropertiesBasicResource, + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: IO[bytes], + proxy_api_version: Optional[str] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Required. + :type body: IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + workspace_name: str, + endpoint_name: str, + rai_policy_name: str, + body: Union[_models.RaiPolicyPropertiesBasicResource, IO[bytes]], + proxy_api_version: Optional[str] = None, + **kwargs: Any + ) -> LROPoller[_models.RaiPolicyPropertiesBasicResource]: + """Update the state of specified Content Filters associated with the Azure OpenAI account. + + Update the state of specified Content Filters associated with the Azure OpenAI account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param endpoint_name: Name of the endpoint resource. Required. + :type endpoint_name: str + :param rai_policy_name: Name of the Rai Policy. Required. + :type rai_policy_name: str + :param body: Is either a RaiPolicyPropertiesBasicResource type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource or + IO[bytes] + :param proxy_api_version: Api version used by proxy call. Default value is None. + :type proxy_api_version: str + :return: An instance of LROPoller that returns either RaiPolicyPropertiesBasicResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.RaiPolicyPropertiesBasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.RaiPolicyPropertiesBasicResource] = 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_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + endpoint_name=endpoint_name, + rai_policy_name=rai_policy_name, + body=body, + proxy_api_version=proxy_api_version, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("RaiPolicyPropertiesBasicResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.RaiPolicyPropertiesBasicResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.RaiPolicyPropertiesBasicResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 089d9208e62..30217d1780f 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -69,7 +74,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -84,7 +89,7 @@ def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +106,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +124,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,7 +139,7 @@ def build_get_request(resource_group_name: str, registry_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +157,7 @@ def build_get_request(resource_group_name: str, registry_name: str, subscription ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +174,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +193,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +212,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -226,7 +231,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -245,7 +250,7 @@ def build_remove_regions_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -264,7 +269,7 @@ def build_remove_regions_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -302,7 +307,6 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Registry"]: List registries by subscription. - :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: @@ -313,7 +317,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Registry"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -324,15 +328,13 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Registry"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -344,13 +346,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) @@ -360,11 +361,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,10 +378,6 @@ def get_next(next_link=None): 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, **kwargs: Any) -> Iterable["_models.Registry"]: """List registries. @@ -390,7 +387,6 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Reg :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: 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: @@ -401,7 +397,7 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Reg api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RegistryTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,16 +408,14 @@ def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Reg def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -433,13 +427,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RegistryTrackedResourceArmPaginatedResult", pipeline_response) @@ -449,11 +442,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -466,14 +459,8 @@ def get_next(next_link=None): 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 = { + def _delete_initial(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,28 +472,31 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -519,12 +509,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> LROPoller[None]: @@ -538,14 +528,6 @@ def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: A :param registry_name: Name of Azure Machine Learning 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: @@ -559,7 +541,7 @@ def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: A 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, api_version=api_version, @@ -568,11 +550,12 @@ def begin_delete(self, resource_group_name: str, registry_name: str, **kwargs: A params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -583,17 +566,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _models.Registry: @@ -607,12 +586,11 @@ def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _m :param registry_name: Name of Azure Machine Learning 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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -626,21 +604,19 @@ def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,16 +626,12 @@ def get(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> _m error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore @overload def update( @@ -686,7 +658,6 @@ def update( :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: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: @@ -697,7 +668,7 @@ def update( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -713,11 +684,10 @@ def update( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: @@ -728,7 +698,7 @@ def update( self, resource_group_name: str, registry_name: str, - body: Union[_models.PartialRegistryPartialTrackedResource, IO], + body: Union[_models.PartialRegistryPartialTrackedResource, IO[bytes]], **kwargs: Any ) -> _models.Registry: """Update tags. @@ -742,18 +712,14 @@ def update( Required. :type registry_name: str :param body: Details required to create the registry. Is either a - PartialRegistryPartialTrackedResource type or a IO type. Required. + PartialRegistryPartialTrackedResource type or a IO[bytes] 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 + IO[bytes] :return: Registry or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Registry :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -776,7 +742,7 @@ def update( else: _json = self._serialize.body(body, "PartialRegistryPartialTrackedResource") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -784,16 +750,14 @@ def update( content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -803,21 +767,17 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any - ) -> _models.Registry: - error_map = { + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,7 +790,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -840,7 +800,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "Registry") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -848,40 +808,35 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 response.status_code == 200: - deserialized = self._deserialize("Registry", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}" - } - @overload def begin_create_or_update( self, @@ -907,14 +862,6 @@ def begin_create_or_update( :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: @@ -925,7 +872,7 @@ def begin_create_or_update( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -941,18 +888,10 @@ def begin_create_or_update( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -960,7 +899,7 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Registry]: """Create or update registry. @@ -972,20 +911,9 @@ def begin_create_or_update( :param registry_name: Name of Azure Machine Learning registry. This is case-insensitive. Required. :type registry_name: str - :param body: Details required to create the registry. Is either a Registry 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. + :param body: Details required to create the registry. Is either a Registry type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO[bytes] :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: @@ -1011,12 +939,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1028,22 +957,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Registry].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}" - } + return LROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _remove_regions_initial( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any - ) -> Optional[_models.Registry]: - error_map = { + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1056,7 +983,7 @@ def _remove_regions_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1066,7 +993,7 @@ def _remove_regions_initial( else: _json = self._serialize.body(body, "Registry") - request = build_remove_regions_request( + _request = build_remove_regions_request( resource_group_name=resource_group_name, registry_name=registry_name, subscription_id=self._config.subscription_id, @@ -1074,30 +1001,29 @@ def _remove_regions_initial( content_type=content_type, json=_json, content=_content, - template_url=self._remove_regions_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Registry", pipeline_response) - if response.status_code == 202: response_headers["x-ms-async-operation-timeout"] = self._deserialize( "duration", response.headers.get("x-ms-async-operation-timeout") @@ -1105,14 +1031,12 @@ def _remove_regions_initial( 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) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _remove_regions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/removeRegions" - } + return deserialized # type: ignore @overload def begin_remove_regions( @@ -1139,14 +1063,6 @@ def begin_remove_regions( :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: @@ -1157,7 +1073,7 @@ def begin_remove_regions( self, resource_group_name: str, registry_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1173,18 +1089,10 @@ def begin_remove_regions( Required. :type registry_name: str :param body: Details required to create the registry. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -1192,7 +1100,7 @@ def begin_remove_regions( @distributed_trace def begin_remove_regions( - self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO], **kwargs: Any + self, resource_group_name: str, registry_name: str, body: Union[_models.Registry, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Registry]: """Remove regions from registry. @@ -1204,20 +1112,9 @@ def begin_remove_regions( :param registry_name: Name of Azure Machine Learning registry. This is case-insensitive. Required. :type registry_name: str - :param body: Details required to create the registry. Is either a Registry 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. + :param body: Details required to create the registry. Is either a Registry type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Registry or IO[bytes] :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: @@ -1243,12 +1140,13 @@ def begin_remove_regions( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response) + deserialized = self._deserialize("Registry", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1260,14 +1158,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Registry].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_remove_regions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/removeRegions" - } + return LROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index c925671f74d..48cc2b7b3ed 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +87,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +106,7 @@ def build_delete_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,7 +123,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -137,7 +142,7 @@ def build_get_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +159,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -174,7 +179,7 @@ def build_create_or_update_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,7 +227,6 @@ def list( :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: @@ -233,7 +237,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,18 +248,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -267,13 +269,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CodeContainerResourceArmPaginatedResult", pipeline_response) @@ -283,11 +284,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -300,14 +301,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,29 +316,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -354,12 +354,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -377,14 +377,6 @@ def begin_delete( :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: @@ -398,7 +390,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -408,11 +400,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -423,17 +416,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, registry_name: str, code_name: str, **kwargs: Any) -> _models.CodeContainer: @@ -449,12 +438,11 @@ def get(self, resource_group_name: str, registry_name: str, code_name: str, **kw :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -468,22 +456,20 @@ def get(self, resource_group_name: str, registry_name: str, code_name: str, **kw api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -493,26 +479,22 @@ def get(self, resource_group_name: str, registry_name: str, code_name: str, **kw error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, registry_name: str, code_name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any - ) -> _models.CodeContainer: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -525,7 +507,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -535,7 +517,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "CodeContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -544,29 +526,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -575,17 +557,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -614,14 +592,6 @@ def begin_create_or_update( :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] @@ -634,7 +604,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, code_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -652,18 +622,10 @@ def begin_create_or_update( :param code_name: Container name. Required. :type code_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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] @@ -676,7 +638,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, code_name: str, - body: Union[_models.CodeContainer, IO], + body: Union[_models.CodeContainer, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CodeContainer]: """Create or update Code container. @@ -691,20 +653,9 @@ def begin_create_or_update( :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 CodeContainer 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. + :param body: Container entity to create or update. Is either a CodeContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeContainer or IO[bytes] :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] @@ -732,12 +683,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CodeContainer", pipeline_response) + deserialized = self._deserialize("CodeContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -749,14 +701,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CodeContainer].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}" - } + return LROPoller[_models.CodeContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 431682513a3..9c7de3893ee 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +77,7 @@ def build_list_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,7 +100,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +120,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -132,7 +137,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -152,7 +157,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -169,7 +174,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -190,7 +195,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,13 +208,13 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_get_start_pending_upload_request( +def build_create_or_get_start_pending_upload_request( # pylint: disable=name-too-long 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -230,7 +235,7 @@ def build_create_or_get_start_pending_upload_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -291,7 +296,6 @@ def list( :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: @@ -302,7 +306,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +317,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -322,12 +326,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -339,13 +341,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CodeVersionResourceArmPaginatedResult", pipeline_response) @@ -355,11 +356,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,14 +373,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, code_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -391,30 +388,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -427,12 +427,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -452,14 +452,6 @@ def begin_delete( :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: @@ -473,7 +465,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -484,11 +476,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -499,17 +492,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -529,12 +518,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -548,23 +536,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CodeVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,16 +560,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -591,10 +573,10 @@ def _create_or_update_initial( registry_name: str, code_name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any - ) -> _models.CodeVersion: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -607,7 +589,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -617,7 +599,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "CodeVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -627,29 +609,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -658,17 +640,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -700,14 +678,6 @@ def begin_create_or_update( :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] @@ -721,7 +691,7 @@ def begin_create_or_update( registry_name: str, code_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -741,18 +711,10 @@ def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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] @@ -766,7 +728,7 @@ def begin_create_or_update( registry_name: str, code_name: str, version: str, - body: Union[_models.CodeVersion, IO], + body: Union[_models.CodeVersion, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CodeVersion]: """Create or update version. @@ -783,20 +745,9 @@ def begin_create_or_update( :type code_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a CodeVersion 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. + :param body: Version entity to create or update. Is either a CodeVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.CodeVersion or IO[bytes] :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] @@ -825,12 +776,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CodeVersion", pipeline_response) + deserialized = self._deserialize("CodeVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -842,17 +794,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CodeVersion].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}" - } + return LROPoller[_models.CodeVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def create_or_get_start_pending_upload( @@ -885,7 +835,6 @@ def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -898,7 +847,7 @@ def create_or_get_start_pending_upload( registry_name: str, code_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -918,11 +867,10 @@ def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -935,7 +883,7 @@ def create_or_get_start_pending_upload( registry_name: str, code_name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a code asset to. @@ -952,18 +900,14 @@ def create_or_get_start_pending_upload( :type code_name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -986,7 +930,7 @@ def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, code_name=code_name, @@ -996,16 +940,14 @@ def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1015,13 +957,9 @@ def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/codes/{codeName}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 index 8fa9042f77a..36e96e897b3 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +68,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -82,7 +87,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -103,7 +108,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,7 +125,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,7 +146,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -158,7 +163,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +185,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -228,7 +233,6 @@ def list( :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] @@ -240,7 +244,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -251,18 +255,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -274,13 +276,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ComponentContainerResourceArmPaginatedResult", pipeline_response) @@ -290,11 +291,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,14 +308,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, component_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,29 +323,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -361,12 +361,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -384,14 +384,6 @@ def begin_delete( :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: @@ -405,7 +397,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -415,11 +407,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -430,17 +423,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -458,12 +447,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -477,22 +465,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -502,26 +488,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, registry_name: str, component_name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any - ) -> _models.ComponentContainer: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -534,7 +516,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -544,7 +526,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "ComponentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -553,29 +535,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -584,17 +566,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -623,14 +601,6 @@ def begin_create_or_update( :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: @@ -644,7 +614,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, component_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -662,18 +632,10 @@ def begin_create_or_update( :param component_name: Container name. Required. :type component_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -687,7 +649,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, component_name: str, - body: Union[_models.ComponentContainer, IO], + body: Union[_models.ComponentContainer, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ComponentContainer]: """Create or update container. @@ -702,20 +664,9 @@ def begin_create_or_update( :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 ComponentContainer 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. + :param body: Container entity to create or update. Is either a ComponentContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentContainer or IO[bytes] :return: An instance of LROPoller that returns either ComponentContainer or the result of cls(response) :rtype: @@ -744,12 +695,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComponentContainer", pipeline_response) + deserialized = self._deserialize("ComponentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -761,14 +713,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ComponentContainer].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}" - } + return LROPoller[_models.ComponentContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 7bb69cf38e1..8b4097ae88e 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +58,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -97,7 +102,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -119,7 +124,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +141,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +180,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +203,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -259,7 +264,6 @@ def list( :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] @@ -271,7 +275,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -282,7 +286,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -291,12 +295,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -308,13 +310,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ComponentVersionResourceArmPaginatedResult", pipeline_response) @@ -324,11 +325,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -341,14 +342,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, component_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,30 +357,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -396,12 +396,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -421,14 +421,6 @@ def begin_delete( :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: @@ -442,7 +434,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -453,11 +445,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -468,17 +461,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -498,12 +487,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,23 +505,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ComponentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -543,16 +529,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/components/{componentName}/versions/{version}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -560,10 +542,10 @@ def _create_or_update_initial( registry_name: str, component_name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any - ) -> _models.ComponentVersion: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -576,7 +558,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -586,7 +568,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "ComponentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, component_name=component_name, @@ -596,29 +578,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -627,17 +609,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -669,14 +647,6 @@ def begin_create_or_update( :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: @@ -691,7 +661,7 @@ def begin_create_or_update( registry_name: str, component_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -711,18 +681,10 @@ def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -737,7 +699,7 @@ def begin_create_or_update( registry_name: str, component_name: str, version: str, - body: Union[_models.ComponentVersion, IO], + body: Union[_models.ComponentVersion, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ComponentVersion]: """Create or update version. @@ -754,20 +716,9 @@ def begin_create_or_update( :type component_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ComponentVersion 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. + :param body: Version entity to create or update. Is either a ComponentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ComponentVersion or IO[bytes] :return: An instance of LROPoller that returns either ComponentVersion or the result of cls(response) :rtype: @@ -797,12 +748,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ComponentVersion", pipeline_response) + deserialized = self._deserialize("ComponentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -814,14 +766,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ComponentVersion].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}" - } + return LROPoller[_models.ComponentVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_containers_operations.py index a5a3f85fe64..721df9d0bfc 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_containers_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_containers_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +150,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +167,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +187,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +243,6 @@ 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DataContainer or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.DataContainer] :raises ~azure.core.exceptions.HttpResponseError: @@ -249,7 +253,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,19 +264,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -284,13 +286,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DataContainerResourceArmPaginatedResult", pipeline_response) @@ -300,11 +301,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,14 +318,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, registry_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,29 +333,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -371,12 +371,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, registry_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -392,14 +392,6 @@ def begin_delete(self, resource_group_name: str, registry_name: str, name: str, :type registry_name: str :param name: Container name. Required. :type 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: @@ -413,7 +405,7 @@ def begin_delete(self, resource_group_name: str, registry_name: str, name: str, 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -423,11 +415,12 @@ def begin_delete(self, resource_group_name: str, registry_name: str, name: str, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -438,17 +431,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}/data/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, registry_name: str, name: str, **kwargs: Any) -> _models.DataContainer: @@ -464,12 +453,11 @@ def get(self, resource_group_name: str, registry_name: str, name: str, **kwargs: :type registry_name: str :param name: Container name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: DataContainer or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataContainer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -483,22 +471,20 @@ def get(self, resource_group_name: str, registry_name: str, name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataContainer] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -508,26 +494,22 @@ def get(self, resource_group_name: str, registry_name: str, name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, registry_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any - ) -> _models.DataContainer: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,7 +522,7 @@ def _create_or_update_initial( api_version: str = 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.DataContainer] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -550,7 +532,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "DataContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -559,29 +541,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DataContainer", 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") @@ -590,17 +572,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/data/{name}" - } - @overload def begin_create_or_update( self, @@ -629,14 +607,6 @@ def begin_create_or_update( :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 DataContainer or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.DataContainer] @@ -649,7 +619,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -667,18 +637,10 @@ def begin_create_or_update( :param name: Container name. Required. :type name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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 DataContainer or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.DataContainer] @@ -691,7 +653,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, name: str, - body: Union[_models.DataContainer, IO], + body: Union[_models.DataContainer, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DataContainer]: """Create or update container. @@ -706,20 +668,9 @@ def begin_create_or_update( :type registry_name: str :param name: Container name. Required. :type name: str - :param body: Container entity to create or update. Is either a DataContainer type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataContainer 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. + :param body: Container entity to create or update. Is either a DataContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataContainer or IO[bytes] :return: An instance of LROPoller that returns either DataContainer or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.DataContainer] @@ -747,12 +698,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataContainer", pipeline_response) + deserialized = self._deserialize("DataContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -764,14 +716,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DataContainer].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}/data/{name}" - } + return LROPoller[_models.DataContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_references_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_references_operations.py new file mode 100644 index 00000000000..5e1bacb4275 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_references_operations.py @@ -0,0 +1,259 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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_get_blob_reference_sas_request( + resource_group_name: str, registry_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/datareferences/{name}/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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + "version": _SERIALIZER.url("version", version, "str"), + } + + _url: str = _url.format(**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 RegistryDataReferencesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`registry_data_references` 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") + + @overload + def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: _models.GetBlobReferenceSASRequestDto, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_blob_reference_sas( + self, + resource_group_name: str, + registry_name: str, + name: str, + version: str, + body: Union[_models.GetBlobReferenceSASRequestDto, IO[bytes]], + **kwargs: Any + ) -> _models.GetBlobReferenceSASResponseDto: + """Get blob reference SAS Uri. + + Get blob reference SAS Uri. + + :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. This is case-insensitive. + Required. + :type registry_name: str + :param name: Data reference name. Required. + :type name: str + :param version: Version identifier. Required. + :type version: str + :param body: Asset id and blob uri. Is either a GetBlobReferenceSASRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASRequestDto or + IO[bytes] + :return: GetBlobReferenceSASResponseDto or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.GetBlobReferenceSASResponseDto + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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.GetBlobReferenceSASResponseDto] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "GetBlobReferenceSASRequestDto") + + _request = build_get_blob_reference_sas_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + name=name, + version=version, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("GetBlobReferenceSASResponseDto", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_versions_operations.py index 7fda48b3778..8430fa888bd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_versions_operations.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_registry_data_versions_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +60,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +79,7 @@ def build_list_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -101,7 +106,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +126,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,7 +143,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +163,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -175,7 +180,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -196,7 +201,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,13 +214,13 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_get_start_pending_upload_request( +def build_create_or_get_start_pending_upload_request( # pylint: disable=name-too-long resource_group_name: str, registry_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -236,7 +241,7 @@ def build_create_or_get_start_pending_upload_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -309,7 +314,6 @@ def list( ListViewType.All]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 DataVersionBase or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.DataVersionBase] @@ -321,7 +325,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBaseResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,7 +336,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -343,12 +347,10 @@ def prepare_request(next_link=None): tags=tags, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -360,13 +362,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("DataVersionBaseResourceArmPaginatedResult", pipeline_response) @@ -376,11 +377,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -393,14 +394,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, registry_name: str, name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,30 +409,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -448,12 +448,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -473,14 +473,6 @@ def begin_delete( :type 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: @@ -494,7 +486,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -505,11 +497,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -520,17 +513,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}/data/{name}/versions/{version}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -550,12 +539,11 @@ def get( :type 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: DataVersionBase or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.DataVersionBase :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -569,23 +557,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DataVersionBase] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, registry_name=registry_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -595,16 +581,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -612,10 +594,10 @@ def _create_or_update_initial( registry_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any - ) -> _models.DataVersionBase: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +610,7 @@ def _create_or_update_initial( api_version: str = 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.DataVersionBase] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -638,7 +620,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "DataVersionBase") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -648,29 +630,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DataVersionBase", 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") @@ -679,17 +661,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/data/{name}/versions/{version}" - } - @overload def begin_create_or_update( self, @@ -721,14 +699,6 @@ def begin_create_or_update( :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 DataVersionBase or the result of cls(response) :rtype: @@ -743,7 +713,7 @@ def begin_create_or_update( registry_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -763,18 +733,10 @@ def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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 DataVersionBase or the result of cls(response) :rtype: @@ -789,7 +751,7 @@ def begin_create_or_update( registry_name: str, name: str, version: str, - body: Union[_models.DataVersionBase, IO], + body: Union[_models.DataVersionBase, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DataVersionBase]: """Create or update version. @@ -806,20 +768,9 @@ def begin_create_or_update( :type name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a DataVersionBase type or a IO type. - Required. - :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase 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. + :param body: Version entity to create or update. Is either a DataVersionBase type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.DataVersionBase or IO[bytes] :return: An instance of LROPoller that returns either DataVersionBase or the result of cls(response) :rtype: @@ -849,12 +800,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DataVersionBase", pipeline_response) + deserialized = self._deserialize("DataVersionBase", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -866,17 +818,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DataVersionBase].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}/data/{name}/versions/{version}" - } + return LROPoller[_models.DataVersionBase]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def create_or_get_start_pending_upload( @@ -909,7 +859,6 @@ def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -922,7 +871,7 @@ def create_or_get_start_pending_upload( registry_name: str, name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -942,11 +891,10 @@ def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -959,7 +907,7 @@ def create_or_get_start_pending_upload( registry_name: str, name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a data asset to. @@ -976,18 +924,14 @@ def create_or_get_start_pending_upload( :type name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1010,7 +954,7 @@ def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, name=name, @@ -1020,16 +964,14 @@ def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1039,13 +981,9 @@ def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/data/{name}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 index 3a3ff9edbad..c96653cd9bf 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +116,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,7 +133,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -149,7 +154,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -166,7 +171,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -188,7 +193,7 @@ def build_create_or_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -244,7 +249,6 @@ 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 - :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: @@ -257,7 +261,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -268,19 +272,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -292,13 +294,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EnvironmentContainerResourceArmPaginatedResult", pipeline_response) @@ -308,11 +309,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -325,14 +326,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, environment_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,29 +341,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -379,12 +379,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -402,14 +402,6 @@ def begin_delete( :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: @@ -423,7 +415,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -433,11 +425,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -448,17 +441,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -476,12 +465,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -495,22 +483,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -520,26 +506,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, registry_name: str, environment_name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any - ) -> _models.EnvironmentContainer: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -552,7 +534,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -562,7 +544,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "EnvironmentContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -571,29 +553,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -602,17 +584,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -641,14 +619,6 @@ def begin_create_or_update( :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: @@ -662,7 +632,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, environment_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -680,18 +650,10 @@ def begin_create_or_update( :param environment_name: Container name. Required. :type environment_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -705,7 +667,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, environment_name: str, - body: Union[_models.EnvironmentContainer, IO], + body: Union[_models.EnvironmentContainer, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.EnvironmentContainer]: """Create or update container. @@ -721,19 +683,8 @@ def begin_create_or_update( :param environment_name: Container name. Required. :type environment_name: str :param body: Container entity to create or update. Is either a EnvironmentContainer 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. + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentContainer or IO[bytes] :return: An instance of LROPoller that returns either EnvironmentContainer or the result of cls(response) :rtype: @@ -762,12 +713,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EnvironmentContainer", pipeline_response) + deserialized = self._deserialize("EnvironmentContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -779,14 +731,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.EnvironmentContainer].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}" - } + return LROPoller[_models.EnvironmentContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 727a7a9602c..fa6d0611a0a 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +59,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,7 +80,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,7 +110,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +132,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,7 +154,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -171,7 +176,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -193,7 +198,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -216,7 +221,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,7 +286,6 @@ 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 - :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] @@ -293,7 +297,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -304,7 +308,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -314,12 +318,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -331,13 +333,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("EnvironmentVersionResourceArmPaginatedResult", pipeline_response) @@ -347,11 +348,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,14 +365,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, environment_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -383,30 +380,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -419,12 +419,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -444,14 +444,6 @@ def begin_delete( :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: @@ -465,7 +457,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -476,11 +468,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -491,17 +484,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -521,12 +510,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -540,23 +528,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EnvironmentVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -566,16 +552,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/environments/{environmentName}/versions/{version}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -583,10 +565,10 @@ def _create_or_update_initial( registry_name: str, environment_name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any - ) -> _models.EnvironmentVersion: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -599,7 +581,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -609,7 +591,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "EnvironmentVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, environment_name=environment_name, @@ -619,29 +601,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -650,17 +632,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -692,14 +670,6 @@ def begin_create_or_update( :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: @@ -714,7 +684,7 @@ def begin_create_or_update( registry_name: str, environment_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -734,18 +704,10 @@ def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -760,7 +722,7 @@ def begin_create_or_update( registry_name: str, environment_name: str, version: str, - body: Union[_models.EnvironmentVersion, IO], + body: Union[_models.EnvironmentVersion, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.EnvironmentVersion]: """Create or update version. @@ -777,20 +739,9 @@ def begin_create_or_update( :type environment_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a EnvironmentVersion 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. + :param body: Version entity to create or update. Is either a EnvironmentVersion type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.EnvironmentVersion or IO[bytes] :return: An instance of LROPoller that returns either EnvironmentVersion or the result of cls(response) :rtype: @@ -820,12 +771,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("EnvironmentVersion", pipeline_response) + deserialized = self._deserialize("EnvironmentVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -837,14 +789,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.EnvironmentVersion].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}" - } + return LROPoller[_models.EnvironmentVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index 8c44417d63e..b365b1466cc 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_delete_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +150,7 @@ def build_get_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +167,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +187,7 @@ def build_create_or_update_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -238,7 +243,6 @@ 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 - :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: @@ -249,7 +253,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainerResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,19 +264,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -284,13 +286,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ModelContainerResourceArmPaginatedResult", pipeline_response) @@ -300,11 +301,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -317,14 +318,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, model_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,29 +333,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -371,12 +371,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -394,14 +394,6 @@ def begin_delete( :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: @@ -415,7 +407,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -425,11 +417,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -440,17 +433,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -468,12 +457,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -487,22 +475,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelContainer] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,26 +498,22 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, registry_name: str, model_name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any - ) -> _models.ModelContainer: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -544,7 +526,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -554,7 +536,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "ModelContainer") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -563,29 +545,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -594,17 +576,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -633,14 +611,6 @@ def begin_create_or_update( :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: @@ -654,7 +624,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, model_name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -672,18 +642,10 @@ def begin_create_or_update( :param model_name: Container name. Required. :type model_name: str :param body: Container entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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: @@ -697,7 +659,7 @@ def begin_create_or_update( resource_group_name: str, registry_name: str, model_name: str, - body: Union[_models.ModelContainer, IO], + body: Union[_models.ModelContainer, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ModelContainer]: """Create or update model container. @@ -712,20 +674,9 @@ def begin_create_or_update( :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 ModelContainer 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. + :param body: Container entity to create or update. Is either a ModelContainer type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelContainer or IO[bytes] :return: An instance of LROPoller that returns either ModelContainer or the result of cls(response) :rtype: @@ -754,12 +705,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ModelContainer", pipeline_response) + deserialized = self._deserialize("ModelContainer", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -771,14 +723,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ModelContainer].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}" - } + return LROPoller[_models.ModelContainer]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 index d883c93e743..b637c6310de 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +63,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,7 +82,7 @@ def build_list_request( "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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -110,7 +115,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -130,7 +135,7 @@ def build_delete_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -147,7 +152,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,7 +172,7 @@ def build_get_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -184,7 +189,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -205,7 +210,7 @@ def build_create_or_update_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -218,13 +223,13 @@ def build_create_or_update_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_get_start_pending_upload_request( +def build_create_or_get_start_pending_upload_request( # pylint: disable=name-too-long 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -245,7 +250,7 @@ def build_create_or_get_start_pending_upload_request( "version": _SERIALIZER.url("version", version, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -324,7 +329,6 @@ 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 - :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: @@ -335,7 +339,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersionResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -346,7 +350,7 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -360,12 +364,10 @@ def prepare_request(next_link=None): 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -377,13 +379,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ModelVersionResourceArmPaginatedResult", pipeline_response) @@ -393,11 +394,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -410,14 +411,10 @@ def get_next(next_link=None): 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 + def _delete_initial( self, resource_group_name: str, registry_name: str, model_name: str, version: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,30 +426,33 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -465,12 +465,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" - } + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -490,14 +490,6 @@ def begin_delete( :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: @@ -511,7 +503,7 @@ def begin_delete( 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -522,11 +514,12 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -537,17 +530,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -567,12 +556,11 @@ def get( :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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,23 +574,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelVersion] = kwargs.pop("cls", None) - request = build_get_request( + _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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -612,16 +598,12 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}" - } + return deserialized # type: ignore def _create_or_update_initial( self, @@ -629,10 +611,10 @@ def _create_or_update_initial( registry_name: str, model_name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any - ) -> _models.ModelVersion: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -645,7 +627,7 @@ def _create_or_update_initial( api_version: str = 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -655,7 +637,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "ModelVersion") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -665,29 +647,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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") @@ -696,17 +678,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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, @@ -738,14 +716,6 @@ def begin_create_or_update( :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] @@ -759,7 +729,7 @@ def begin_create_or_update( registry_name: str, model_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -779,18 +749,10 @@ def begin_create_or_update( :param version: Version identifier. Required. :type version: str :param body: Version entity to create or update. Required. - :type body: IO + :type body: IO[bytes] :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] @@ -804,7 +766,7 @@ def begin_create_or_update( registry_name: str, model_name: str, version: str, - body: Union[_models.ModelVersion, IO], + body: Union[_models.ModelVersion, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ModelVersion]: """Create or update version. @@ -821,20 +783,9 @@ def begin_create_or_update( :type model_name: str :param version: Version identifier. Required. :type version: str - :param body: Version entity to create or update. Is either a ModelVersion 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. + :param body: Version entity to create or update. Is either a ModelVersion type or a IO[bytes] + type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ModelVersion or IO[bytes] :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] @@ -863,12 +814,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ModelVersion", pipeline_response) + deserialized = self._deserialize("ModelVersion", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -880,17 +832,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ModelVersion].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}" - } + return LROPoller[_models.ModelVersion]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def create_or_get_start_pending_upload( @@ -923,7 +873,6 @@ def create_or_get_start_pending_upload( :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -936,7 +885,7 @@ def create_or_get_start_pending_upload( registry_name: str, model_name: str, version: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -956,11 +905,10 @@ def create_or_get_start_pending_upload( :param version: Version identifier. This is case-sensitive. Required. :type version: str :param body: Pending upload request object. Required. - :type body: IO + :type body: IO[bytes] :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: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: @@ -973,7 +921,7 @@ def create_or_get_start_pending_upload( registry_name: str, model_name: str, version: str, - body: Union[_models.PendingUploadRequestDto, IO], + body: Union[_models.PendingUploadRequestDto, IO[bytes]], **kwargs: Any ) -> _models.PendingUploadResponseDto: """Generate a storage location and credential for the client to upload a model asset to. @@ -990,18 +938,14 @@ def create_or_get_start_pending_upload( :type model_name: str :param version: Version identifier. This is case-sensitive. Required. :type version: str - :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a IO - type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto 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 + :param body: Pending upload request object. Is either a PendingUploadRequestDto type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.PendingUploadRequestDto or IO[bytes] :return: PendingUploadResponseDto or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.PendingUploadResponseDto :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1024,7 +968,7 @@ def create_or_get_start_pending_upload( else: _json = self._serialize.body(body, "PendingUploadRequestDto") - request = build_create_or_get_start_pending_upload_request( + _request = build_create_or_get_start_pending_upload_request( resource_group_name=resource_group_name, registry_name=registry_name, model_name=model_name, @@ -1034,16 +978,14 @@ def create_or_get_start_pending_upload( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_get_start_pending_upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1053,13 +995,9 @@ def create_or_get_start_pending_upload( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response) + deserialized = self._deserialize("PendingUploadResponseDto", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create_or_get_start_pending_upload.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/registries/{registryName}/models/{modelName}/versions/{version}/startPendingUpload" - } + return deserialized # type: ignore 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 2e25ec11855..fd99b4ba547 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +74,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +95,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +114,7 @@ def build_delete_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,7 +131,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,7 +150,7 @@ def build_get_request( "name": _SERIALIZER.url("name", name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,7 +167,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -182,7 +187,7 @@ def build_create_or_update_request( "name": _SERIALIZER.url("name", 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 + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -237,7 +242,6 @@ def list( :param list_view_type: Status filter for schedule. Known values are: "EnabledOnly", "DisabledOnly", and "All". Default value is None. :type list_view_type: str or ~azure.mgmt.machinelearningservices.models.ScheduleListViewType - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Schedule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Schedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -248,7 +252,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ScheduleResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,19 +263,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -283,13 +285,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ScheduleResourceArmPaginatedResult", pipeline_response) @@ -299,11 +300,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -316,14 +317,10 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -335,29 +332,32 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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) @@ -370,12 +370,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" - } + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -390,14 +390,6 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, :type workspace_name: str :param name: Schedule name. Required. :type 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: @@ -411,7 +403,7 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -421,11 +413,12 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -436,17 +429,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].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/workspaces/{workspaceName}/schedules/{name}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> _models.Schedule: @@ -461,12 +450,11 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs :type workspace_name: str :param name: Schedule name. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Schedule or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.Schedule :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -480,22 +468,20 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Schedule] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -505,21 +491,22 @@ def get(self, resource_group_name: str, workspace_name: str, name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = self._deserialize("Schedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/schedules/{name}" - } + return deserialized # type: ignore def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, name: str, body: Union[_models.Schedule, IO], **kwargs: Any - ) -> _models.Schedule: - error_map = { + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.Schedule, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -532,7 +519,7 @@ def _create_or_update_initial( api_version: str = 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.Schedule] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -542,7 +529,7 @@ def _create_or_update_initial( else: _json = self._serialize.body(body, "Schedule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, name=name, @@ -551,29 +538,29 @@ def _create_or_update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Schedule", 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") @@ -582,17 +569,13 @@ def _create_or_update_initial( "str", response.headers.get("Azure-AsyncOperation") ) - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) 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}/schedules/{name}" - } - @overload def begin_create_or_update( self, @@ -620,14 +603,6 @@ def begin_create_or_update( :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 Schedule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Schedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -639,7 +614,7 @@ def begin_create_or_update( resource_group_name: str, workspace_name: str, name: str, - body: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -656,18 +631,10 @@ def begin_create_or_update( :param name: Schedule name. Required. :type name: str :param body: Schedule definition. Required. - :type body: IO + :type body: IO[bytes] :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 Schedule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Schedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -675,7 +642,12 @@ def begin_create_or_update( @distributed_trace def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, name: str, body: Union[_models.Schedule, IO], **kwargs: Any + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.Schedule, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.Schedule]: """Create or update schedule. @@ -688,19 +660,8 @@ def begin_create_or_update( :type workspace_name: str :param name: Schedule name. Required. :type name: str - :param body: Schedule definition. Is either a Schedule type or a IO type. Required. - :type body: ~azure.mgmt.machinelearningservices.models.Schedule 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. + :param body: Schedule definition. Is either a Schedule type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Schedule or IO[bytes] :return: An instance of LROPoller that returns either Schedule or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Schedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -727,12 +688,13 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Schedule", pipeline_response) + deserialized = self._deserialize("Schedule", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -744,14 +706,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Schedule].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}/schedules/{name}" - } + return LROPoller[_models.Schedule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_serverless_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_serverless_endpoints_operations.py new file mode 100644 index 00000000000..fb6b4d4b5eb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/azure/mgmt/machinelearningservices/operations/_serverless_endpoints_operations.py @@ -0,0 +1,1334 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +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 + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # 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, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/serverlessEndpoints/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/serverlessEndpoints/{name}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z][a-zA-Z0-9-]{0,51}$"), + } + + _url: str = _url.format(**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_list_keys_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/serverlessEndpoints/{name}/listKeys", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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_regenerate_keys_request( + resource_group_name: str, workspace_name: str, 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/serverlessEndpoints/{name}/regenerateKeys", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "name": _SERIALIZER.url("name", name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$"), + } + + _url: str = _url.format(**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 ServerlessEndpointsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`serverless_endpoints` 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, **kwargs: Any + ) -> Iterable["_models.ServerlessEndpoint"]: + """List Serverless Endpoints. + + List Serverless Endpoints. + + :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 + :return: An iterator like instance of either ServerlessEndpoint or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServerlessEndpointTrackedResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ServerlessEndpointTrackedResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any) -> LROPoller[None]: + """Delete Serverless Endpoint (asynchronous). + + Delete Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :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: str = 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( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.ServerlessEndpoint: + """Get Serverless Endpoint. + + Get Serverless Endpoint. + + :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 name: Serverless Endpoint name. Required. + :type name: str + :return: ServerlessEndpoint or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ServerlessEndpoint] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("ServerlessEndpoint", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "PartialMinimalTrackedResourceWithSkuAndIdentity") + + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.PartialMinimalTrackedResourceWithSkuAndIdentity, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.PartialMinimalTrackedResourceWithSkuAndIdentity, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Update Serverless Endpoint (asynchronous). + + Update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Is either a + PartialMinimalTrackedResourceWithSkuAndIdentity type or a IO[bytes] type. Required. + :type body: + ~azure.mgmt.machinelearningservices.models.PartialMinimalTrackedResourceWithSkuAndIdentity or + IO[bytes] + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ServerlessEndpoint] = 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, + workspace_name=workspace_name, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ServerlessEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServerlessEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "ServerlessEndpoint") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 == 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.ServerlessEndpoint, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.ServerlessEndpoint, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ServerlessEndpoint]: + """Create or update Serverless Endpoint (asynchronous). + + Create or update Serverless Endpoint (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: Serverless Endpoint entity to apply during operation. Is either a + ServerlessEndpoint type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.ServerlessEndpoint or IO[bytes] + :return: An instance of LROPoller that returns either ServerlessEndpoint or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.ServerlessEndpoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.ServerlessEndpoint] = 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, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ServerlessEndpoint", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.ServerlessEndpoint].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServerlessEndpoint]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_keys( + self, resource_group_name: str, workspace_name: str, name: str, **kwargs: Any + ) -> _models.EndpointAuthKeys: + """List EndpointAuthKeys for an Endpoint using Key-based authentication. + + List EndpointAuthKeys for an Endpoint using Key-based authentication. + + :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 name: Serverless Endpoint name. Required. + :type name: str + :return: EndpointAuthKeys or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.EndpointAuthKeys + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.EndpointAuthKeys] = kwargs.pop("cls", None) + + _request = build_list_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("EndpointAuthKeys", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _regenerate_keys_initial( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "RegenerateEndpointKeysRequest") + + _request = build_regenerate_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: _models.RegenerateEndpointKeysRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_regenerate_keys( + self, + resource_group_name: str, + workspace_name: str, + name: str, + body: Union[_models.RegenerateEndpointKeysRequest, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.EndpointAuthKeys]: + """Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (asynchronous). + + Regenerate EndpointAuthKeys for an Endpoint using Key-based authentication (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 name: Serverless Endpoint name. Required. + :type name: str + :param body: RegenerateKeys request . Is either a RegenerateEndpointKeysRequest type or a + IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.RegenerateEndpointKeysRequest or + IO[bytes] + :return: An instance of LROPoller that returns either EndpointAuthKeys or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.EndpointAuthKeys] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.EndpointAuthKeys] = 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._regenerate_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + name=name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("EndpointAuthKeys", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.EndpointAuthKeys].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.EndpointAuthKeys]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 3dc29c049f1..881e5ed132a 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +43,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +56,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "location": _SERIALIZER.url("location", location, "str", pattern=r"^[-\w\._]+$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +93,6 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: :param location: The location for which resource usage is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Usage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Usage] :raises ~azure.core.exceptions.HttpResponseError: @@ -101,7 +103,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListUsagesResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,16 +114,14 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Usage"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +133,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ListUsagesResult", pipeline_response) @@ -149,11 +148,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,7 +164,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/usages" - } 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 27bb7d3b448..c6671eb92d7 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,16 +18,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +41,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +54,7 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,12 +90,11 @@ def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSizeListRe :param location: The location upon which virtual-machine-sizes is queried. Required. :type location: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VirtualMachineSizeListResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.VirtualMachineSizeListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,20 +108,18 @@ def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSizeListRe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineSizeListResult] = kwargs.pop("cls", None) - request = build_list_request( + _request = build_list_request( location=location, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,13 +129,9 @@ def list(self, location: str, **kwargs: Any) -> _models.VirtualMachineSizeListRe error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response) + deserialized = self._deserialize("VirtualMachineSizeListResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/locations/{location}/vmSizes" - } + return deserialized # type: ignore 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 28c7857fccf..05066d02127 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,20 +17,26 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse 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, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -37,14 +44,61 @@ _SERIALIZER.client_side_validation = False -def build_create_request( +def build_list_request( + resource_group_name: str, + workspace_name: str, + subscription_id: str, + *, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if include_all is not None: + _params["includeAll"] = _SERIALIZER.query("include_all", include_all, "bool") + + # 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, connection_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,20 +114,20 @@ def build_create_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) def build_get_request( @@ -82,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,10 +152,12 @@ def build_get_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,13 +168,14 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( +def build_update_request( resource_group_name: str, workspace_name: str, connection_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,83 +191,545 @@ def build_delete_request( "workspaceName": _SERIALIZER.url( "workspace_name", workspace_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" ), - "connectionName": _SERIALIZER.url("connection_name", connection_name, "str"), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, - workspace_name: str, - subscription_id: str, - *, - target: Optional[str] = None, - category: Optional[str] = None, - **kwargs: Any +def build_create_request( + resource_group_name: str, workspace_name: str, connection_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections/{connectionName}", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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_list_secrets_request( + resource_group_name: str, workspace_name: str, connection_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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/listsecrets", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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_test_connection_request( + resource_group_name: str, workspace_name: str, connection_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/connections", - ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" - ), - } + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}/testconnection", + ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _url: str = _url.format(**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 WorkspaceConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s + :attr:`workspace_connections` 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, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> Iterable["_models.WorkspaceConnectionPropertiesV2BasicResource"]: + """Lists all the available machine learning workspaces connections under the specified workspace. + + Lists all the available machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param target: Target of the workspace connection. Default value is None. + :type target: str + :param category: Category of the workspace connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either WorkspaceConnectionPropertiesV2BasicResource or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", 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) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete machine learning workspaces connections by name. + + Delete machine learning workspaces connections by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Lists machine learning workspaces connections by name. + + Lists machine learning workspaces connections by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[_models.WorkspaceConnectionUpdateParameter] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Parameters for workspace connection update. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Parameters for workspace connection update. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionUpdateParameter, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: + """Update machine learning workspaces connections under the specified workspace. + + Update machine learning workspaces connections under the specified 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Parameters for workspace connection update. Is either a + WorkspaceConnectionUpdateParameter type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionUpdateParameter or + IO[bytes] + :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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 {}) - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + api_version: str = 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.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - # Construct parameters - if target is not None: - _params["target"] = _SERIALIZER.query("target", target, "str") - if category is not None: - _params["category"] = _SERIALIZER.query("category", category, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionUpdateParameter") + else: + _json = None - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + _request = build_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response -class WorkspaceConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. + 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) - Instead, you should access the following operations through - :class:`~azure.mgmt.machinelearningservices.MachineLearningServicesMgmtClient`'s - :attr:`workspace_connections` attribute. - """ + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) - models = _models + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - 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") + return deserialized # type: ignore @overload def create( @@ -218,27 +737,29 @@ def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: _models.WorkspaceConnectionPropertiesV2BasicResource, + body: Optional[_models.WorkspaceConnectionPropertiesV2BasicResource] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Required. - :type parameters: + :param body: The object for creating or updating a new workspace connection. Default value is + None. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :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: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: @@ -250,26 +771,28 @@ def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: IO, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Required. - :type parameters: IO + :param body: The object for creating or updating a new workspace connection. Default value is + None. + :type body: IO[bytes] :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: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: @@ -281,31 +804,30 @@ def create( resource_group_name: str, workspace_name: str, connection_name: str, - parameters: Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO], + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """create. + """Create or update machine learning workspaces connections under the specified workspace. + + Create or update machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :param parameters: The object for creating or updating a new workspace connection. Is either a - WorkspaceConnectionPropertiesV2BasicResource type or a IO type. Required. - :type parameters: - ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource 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 + :param body: The object for creating or updating a new workspace connection. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or + IO[bytes] :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,12 +845,15 @@ def create( content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(parameters, "WorkspaceConnectionPropertiesV2BasicResource") + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionPropertiesV2BasicResource") + else: + _json = None - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, @@ -337,16 +862,14 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -356,36 +879,35 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } + return deserialized # type: ignore @distributed_trace - def get( + def list_secrets( self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any ) -> _models.WorkspaceConnectionPropertiesV2BasicResource: - """get. + """List all the secrets of a machine learning workspaces connections. + + List all the secrets of a machine learning workspaces connections. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str :param connection_name: Friendly name of the workspace connection. Required. :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: WorkspaceConnectionPropertiesV2BasicResource or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -399,22 +921,20 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_list_secrets_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_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) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,36 +944,24 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceConnectionPropertiesV2BasicResource", pipeline_response) + deserialized = self._deserialize( + "WorkspaceConnectionPropertiesV2BasicResource", pipeline_response.http_response + ) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, connection_name: str, **kwargs: Any - ) -> None: - """delete. + return deserialized # type: ignore - :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 connection_name: Friendly name of the workspace connection. Required. - :type connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { + def _test_connection_initial( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -461,147 +969,202 @@ def delete( # pylint: disable=inconsistent-return-statements } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = kwargs.pop("headers", {}) or {} + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "WorkspaceConnectionPropertiesV2BasicResource") + else: + _json = None - request = build_delete_request( + _request = build_test_connection_request( resource_group_name=resource_group_name, workspace_name=workspace_name, connection_name=connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], + content_type=content_type, + json=_json, + content=_content, headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections/{connectionName}" - } + return deserialized # type: ignore - @distributed_trace - def list( + @overload + def begin_test_connection( self, resource_group_name: str, workspace_name: str, - target: Optional[str] = None, - category: Optional[str] = None, + connection_name: str, + body: Optional[_models.WorkspaceConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", **kwargs: Any - ) -> Iterable["_models.WorkspaceConnectionPropertiesV2BasicResource"]: - """list. + ) -> LROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. + + Test machine learning workspaces connections under the specified 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param target: Target of the workspace connection. Default value is None. - :type target: str - :param category: Category of the workspace connection. Default value is None. - :type category: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceConnectionPropertiesV2BasicResource or - the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource] + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult] = kwargs.pop("cls", None) - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) + @overload + def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. - def prepare_request(next_link=None): - if not next_link: + Test machine learning workspaces connections under the specified workspace. - request = build_list_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - target=target, - category=category, - 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) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Default value is None. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ - 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 + @distributed_trace + def begin_test_connection( + self, + resource_group_name: str, + workspace_name: str, + connection_name: str, + body: Optional[Union[_models.WorkspaceConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Test machine learning workspaces connections under the specified workspace. - def extract_data(pipeline_response): - deserialized = self._deserialize( - "WorkspaceConnectionPropertiesV2BasicResourceArmPaginatedResult", 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) + Test machine learning workspaces connections under the specified workspace. - def get_next(next_link=None): - request = prepare_request(next_link) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param connection_name: Friendly name of the workspace connection. Required. + :type connection_name: str + :param body: Workspace Connection object. Is either a + WorkspaceConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type body: + ~azure.mgmt.machinelearningservices.models.WorkspaceConnectionPropertiesV2BasicResource or + IO[bytes] + :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 = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + api_version: str = 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) + 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._test_connection_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + connection_name=connection_name, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **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) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return pipeline_response - - return ItemPaged(get_next, extract_data) + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/connections" - } + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore 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 a8b05127e63..16ee2c42406 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -19,16 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +45,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +63,7 @@ def build_list_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,7 +102,6 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> :type resource_group_name: str :param workspace_name: Name of Azure Machine Learning workspace. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either AmlUserFeature or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.AmlUserFeature] :raises ~azure.core.exceptions.HttpResponseError: @@ -110,7 +112,7 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListAmlUserFeatureResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,17 +123,15 @@ def list(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, 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) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -143,13 +143,12 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ListAmlUserFeatureResult", pipeline_response) @@ -159,11 +158,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -175,7 +174,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/features" - } 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 3531e4cd54c..8cd44adf0af 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -16,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, 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.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,8 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -39,34 +44,38 @@ _SERIALIZER.client_side_validation = False -def build_get_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any +def build_list_by_subscription_request( + subscription_id: str, + *, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" - ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if kind is not None: + _params["kind"] = _SERIALIZER.query("kind", kind, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if ai_capabilities is not None: + _params["aiCapabilities"] = _SERIALIZER.query("ai_capabilities", ai_capabilities, "str") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -74,51 +83,57 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_create_or_update_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces", ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" - ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if kind is not None: + _params["kind"] = _SERIALIZER.query("kind", kind, "str") + if skip is not None: + _params["$skip"] = _SERIALIZER.query("skip", skip, "str") + if ai_capabilities is not None: + _params["aiCapabilities"] = _SERIALIZER.query("ai_capabilities", ai_capabilities, "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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) def build_delete_request( - resource_group_name: str, workspace_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, workspace_name: str, subscription_id: str, *, force_to_purge: bool = False, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,10 +151,12 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force_to_purge is not None: + _params["forceToPurge"] = _SERIALIZER.query("force_to_purge", force_to_purge, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -147,14 +164,13 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_update_request( +def build_get_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,67 +188,69 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +def build_update_request( + resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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 + 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="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) -def build_diagnose_request( +def build_create_or_update_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/diagnose", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -244,7 +262,7 @@ def build_diagnose_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -254,22 +272,23 @@ def build_diagnose_request( _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) + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_keys_request( +def build_diagnose_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-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}/listKeys", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -281,30 +300,32 @@ def build_list_keys_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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_resync_keys_request( +def build_list_keys_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -316,7 +337,7 @@ def build_resync_keys_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -327,49 +348,54 @@ def build_resync_keys_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_by_subscription_request( - subscription_id: str, *, skip: Optional[str] = None, **kwargs: Any +def build_list_notebook_access_token_request( + resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken", ) # 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", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**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) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_notebook_access_token_request( +def build_list_notebook_keys_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -381,7 +407,7 @@ def build_list_notebook_access_token_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -392,19 +418,19 @@ def build_list_notebook_access_token_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_prepare_notebook_request( +def build_list_storage_account_keys_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -416,7 +442,7 @@ def build_prepare_notebook_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -427,19 +453,19 @@ def build_prepare_notebook_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_storage_account_keys_request( +def build_list_outbound_network_dependencies_endpoints_request( # pylint: disable=name-too-long resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -451,7 +477,7 @@ def build_list_storage_account_keys_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -459,22 +485,22 @@ def build_list_storage_account_keys_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_notebook_keys_request( +def build_prepare_notebook_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -486,7 +512,7 @@ def build_list_notebook_keys_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -497,19 +523,19 @@ def build_list_notebook_keys_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_outbound_network_dependencies_endpoints_request( +def build_resync_keys_request( resource_group_name: str, workspace_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys", ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), @@ -521,7 +547,7 @@ def build_list_outbound_network_dependencies_endpoints_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -529,7 +555,7 @@ def build_list_outbound_network_dependencies_endpoints_request( # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) class WorkspacesOperations: @@ -552,72 +578,34 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: - """Gets the properties of the specified machine learning workspace. + def list_by_subscription( + self, + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.Workspace"]: + """Lists all the available machine learning workspaces under the specified subscription. - :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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Workspace or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + Lists all the available machine learning workspaces under the specified subscription. + + :param kind: Kind of workspace. Default value is None. + :type kind: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param ai_capabilities: Default value is None. + :type ai_capabilities: str + :return: An iterator like instance of either Workspace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - workspace_name=workspace_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) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("Workspace", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) - def _create_or_update_initial( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> Optional[_models.Workspace]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -625,214 +613,163 @@ def _create_or_update_initial( } 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: str = 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.Workspace]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Workspace") + def prepare_request(next_link=None): + if not next_link: - request = build_create_or_update_request( - resource_group_name=resource_group_name, - workspace_name=workspace_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) + _request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) + 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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - response = pipeline_response.http_response + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", 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) - 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) + def get_next(next_link=None): + _request = prepare_request(next_link) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("Workspace", pipeline_response) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response - if cls: - return cls(pipeline_response, deserialized, {}) + 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 deserialized + return pipeline_response - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return ItemPaged(get_next, extract_data) - @overload - def begin_create_or_update( + @distributed_trace + def list_by_resource_group( self, resource_group_name: str, - workspace_name: str, - parameters: _models.Workspace, - *, - content_type: str = "application/json", + kind: Optional[str] = None, + skip: Optional[str] = None, + ai_capabilities: Optional[str] = None, **kwargs: Any - ) -> LROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + ) -> Iterable["_models.Workspace"]: + """Lists all the available machine learning workspaces under the specified resource group. + + Lists all the available machine learning workspaces under the specified resource group. :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 parameters: The parameters for creating or updating a machine learning workspace. - Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace - :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 Workspace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :param kind: Kind of workspace. Default value is None. + :type kind: str + :param skip: Continuation token for pagination. Default value is None. + :type skip: str + :param ai_capabilities: Default value is None. + :type ai_capabilities: str + :return: An iterator like instance of either Workspace or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - @overload - def begin_create_or_update( - self, - resource_group_name: str, - workspace_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) - :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 parameters: The parameters for creating or updating a machine learning workspace. - 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 - :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 Workspace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, workspace_name: str, parameters: Union[_models.Workspace, IO], **kwargs: Any - ) -> LROPoller[_models.Workspace]: - """Creates or updates a workspace with the specified parameters. + def prepare_request(next_link=None): + if not next_link: - :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 parameters: The parameters for creating or updating a machine learning workspace. Is - either a Workspace type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.Workspace 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 Workspace or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + kind=kind, + skip=skip, + ai_capabilities=ai_capabilities, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - api_version: str = 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.Workspace] = 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, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + 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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) + def extract_data(pipeline_response): + deserialized = self._deserialize("WorkspaceListResult", pipeline_response) + list_of_elem = deserialized.value if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) - 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, + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + response = pipeline_response.http_response - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + 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) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: - error_map = { + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _delete_initial( + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -844,56 +781,63 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, + force_to_purge=force_to_purge, 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return deserialized # type: ignore @distributed_trace - def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> LROPoller[None]: + def begin_delete( + self, resource_group_name: str, workspace_name: str, force_to_purge: bool = False, **kwargs: Any + ) -> LROPoller[None]: """Deletes a machine learning workspace. + Deletes a machine learning 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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_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. + :param force_to_purge: Flag to indicate delete is a purge request. Default value is False. + :type force_to_purge: bool :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: @@ -907,48 +851,106 @@ def begin_delete(self, resource_group_name: str, workspace_name: str, **kwargs: 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 + raw_result = self._delete_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, + force_to_purge=force_to_purge, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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( + return LROPoller[None].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 + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + @distributed_trace + def get(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> _models.Workspace: + """Gets the properties of the specified machine learning workspace. + + Gets the properties of the specified machine learning 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: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.Workspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Workspace] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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("Workspace", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore def _update_initial( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Workspace]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -961,17 +963,17 @@ def _update_initial( api_version: str = 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.Workspace]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - _json = self._serialize.body(parameters, "WorkspaceUpdateParameters") + _json = self._serialize.body(body, "WorkspaceUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -979,68 +981,59 @@ def _update_initial( 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) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("Workspace", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}" - } + return deserialized # type: ignore @overload def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: _models.WorkspaceUpdateParameters, + body: _models.WorkspaceUpdateParameters, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Workspace]: """Updates a machine learning workspace with the specified parameters. + Updates a machine learning workspace with the specified parameters. + :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters + :param body: The parameters for updating a machine learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters :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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -1051,31 +1044,25 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: IO, + body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Workspace]: """Updates a machine learning workspace with the specified parameters. + Updates a machine learning workspace with the specified parameters. + :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Required. - :type parameters: IO + :param body: The parameters for updating a machine learning workspace. Required. + :type body: IO[bytes] :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 Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -1086,30 +1073,21 @@ def begin_update( self, resource_group_name: str, workspace_name: str, - parameters: Union[_models.WorkspaceUpdateParameters, IO], + body: Union[_models.WorkspaceUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Workspace]: """Updates a machine learning workspace with the specified parameters. + Updates a machine learning workspace with the specified parameters. + :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameters for updating a machine learning workspace. Is either a - WorkspaceUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters 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. + :param body: The parameters for updating a machine learning workspace. Is either a + WorkspaceUpdateParameters type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.WorkspaceUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] :raises ~azure.core.exceptions.HttpResponseError: @@ -1127,7 +1105,7 @@ def begin_update( raw_result = self._update_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1135,12 +1113,13 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Workspace", pipeline_response) + deserialized = self._deserialize("Workspace", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1150,41 +1129,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Workspace].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/workspaces/{workspaceName}" - } - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, skip: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Workspace"]: - """Lists all the available machine learning workspaces under the specified resource group. - - :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 Workspace or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) + return LROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) - error_map = { + def _create_or_update_initial( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1192,76 +1150,198 @@ def list_by_resource_group( } error_map.update(kwargs.pop("error_map", {}) or {}) - def prepare_request(next_link=None): - if not next_link: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - skip=skip, - api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + api_version: str = 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[Iterator[bytes]] = kwargs.pop("cls", None) - 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 + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + _json = self._serialize.body(body, "Workspace") - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", 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) + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def get_next(next_link=None): - request = prepare_request(next_link) + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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 response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + 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 + 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")) - return ItemPaged(get_next, extract_data) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces" - } + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: _models.Workspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: The parameters for creating or updating a machine learning workspace. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + body: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: The parameters for creating or updating a machine learning workspace. Required. + :type body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_group_name: str, workspace_name: str, body: Union[_models.Workspace, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.Workspace]: + """Creates or updates a workspace with the specified parameters. + + Creates or updates a workspace with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :param body: The parameters for creating or updating a machine learning workspace. Is either a + Workspace type or a IO[bytes] type. Required. + :type body: ~azure.mgmt.machinelearningservices.models.Workspace or IO[bytes] + :return: An instance of LROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.machinelearningservices.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = 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.Workspace] = 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, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("Workspace", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + 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[_models.Workspace].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Workspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _diagnose_initial( self, resource_group_name: str, workspace_name: str, - parameters: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, + body: Optional[Union[_models.DiagnoseWorkspaceParameters, IO[bytes]]] = None, **kwargs: Any - ) -> Optional[_models.DiagnoseResponseResult]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1274,20 +1354,20 @@ def _diagnose_initial( api_version: str = 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.DiagnoseResponseResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters + if isinstance(body, (IOBase, bytes)): + _content = body else: - if parameters is not None: - _json = self._serialize.body(parameters, "DiagnoseWorkspaceParameters") + if body is not None: + _json = self._serialize.body(body, "DiagnoseWorkspaceParameters") else: _json = None - request = build_diagnose_request( + _request = build_diagnose_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, @@ -1295,49 +1375,46 @@ def _diagnose_initial( content_type=content_type, json=_json, content=_content, - template_url=self._diagnose_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("DiagnoseResponseResult", 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 = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _diagnose_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose" - } + return deserialized # type: ignore @overload def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[_models.DiagnoseWorkspaceParameters] = None, + body: Optional[_models.DiagnoseWorkspaceParameters] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1349,21 +1426,13 @@ def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Default value is None. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters + :param body: The parameter of diagnosing workspace health. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters :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 DiagnoseResponseResult or the result of cls(response) :rtype: @@ -1376,7 +1445,7 @@ def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[IO] = None, + body: Optional[IO[bytes]] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1388,21 +1457,13 @@ def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Default value is None. - :type parameters: IO + :param body: The parameter of diagnosing workspace health. Default value is None. + :type body: IO[bytes] :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 DiagnoseResponseResult or the result of cls(response) :rtype: @@ -1415,7 +1476,7 @@ def begin_diagnose( self, resource_group_name: str, workspace_name: str, - parameters: Optional[Union[_models.DiagnoseWorkspaceParameters, IO]] = None, + body: Optional[Union[_models.DiagnoseWorkspaceParameters, IO[bytes]]] = None, **kwargs: Any ) -> LROPoller[_models.DiagnoseResponseResult]: """Diagnose workspace setup issue. @@ -1425,22 +1486,11 @@ def begin_diagnose( :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :param parameters: The parameter of diagnosing workspace health. Is either a - DiagnoseWorkspaceParameters type or a IO type. Default value is None. - :type parameters: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters 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. + :param body: The parameter of diagnosing workspace health. Is either a + DiagnoseWorkspaceParameters type or a IO[bytes] type. Default value is None. + :type body: ~azure.mgmt.machinelearningservices.models.DiagnoseWorkspaceParameters or IO[bytes] :return: An instance of LROPoller that returns either DiagnoseResponseResult or the result of cls(response) :rtype: @@ -1460,7 +1510,7 @@ def begin_diagnose( raw_result = self._diagnose_initial( resource_group_name=resource_group_name, workspace_name=workspace_name, - parameters=parameters, + body=body, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, @@ -1468,12 +1518,13 @@ def begin_diagnose( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DiagnoseResponseResult", pipeline_response) + deserialized = self._deserialize("DiagnoseResponseResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1485,17 +1536,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.DiagnoseResponseResult].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_diagnose.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/diagnose" - } + return LROPoller[_models.DiagnoseResponseResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_keys( @@ -1504,17 +1553,19 @@ def list_keys( """Lists all the keys associated with this workspace. This includes keys for the storage account, app insights and password for container registry. + Lists all the keys associated with this workspace. This includes keys for the storage account, + app insights and password for container registry. + :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ListWorkspaceKeysResult or the result of cls(response) :rtype: ~azure.mgmt.machinelearningservices.models.ListWorkspaceKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1528,21 +1579,19 @@ def list_keys( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ListWorkspaceKeysResult] = kwargs.pop("cls", None) - request = build_list_keys_request( + _request = build_list_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1552,21 +1601,31 @@ def list_keys( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListWorkspaceKeysResult", pipeline_response) + deserialized = self._deserialize("ListWorkspaceKeysResult", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listKeys" - } - - def _resync_keys_initial( # pylint: disable=inconsistent-return-statements + @distributed_trace + def list_notebook_access_token( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> _models.NotebookAccessTokenResult: + """Get Azure Machine Learning Workspace notebook access token. + + Get Azure Machine Learning Workspace notebook access token. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: NotebookAccessTokenResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1578,122 +1637,115 @@ def _resync_keys_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[_models.NotebookAccessTokenResult] = kwargs.pop("cls", None) - request = build_resync_keys_request( + _request = build_list_notebook_access_token_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._resync_keys_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + 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("NotebookAccessTokenResult", pipeline_response.http_response) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - _resync_keys_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" - } + return deserialized # type: ignore @distributed_trace - def begin_resync_keys(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> LROPoller[None]: - """Resync all the keys associated with this workspace. This includes keys for the storage account, - app insights and password for container registry. + def list_notebook_keys( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> _models.ListNotebookKeysResult: + """Lists keys of Azure Machine Learning Workspaces notebook. + + Lists keys of Azure Machine Learning Workspaces notebook. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_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] + :return: ListNotebookKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 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: str = 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._resync_keys_initial( # type: ignore - resource_group_name=resource_group_name, - workspace_name=workspace_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) + cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) + _request = build_list_notebook_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - 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 + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - begin_resync_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/resyncKeys" - } + 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("ListNotebookKeysResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace - def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Workspace"]: - """Lists all the available machine learning workspaces under the specified subscription. + def list_storage_account_keys( + self, resource_group_name: str, workspace_name: str, **kwargs: Any + ) -> _models.ListStorageAccountKeysResult: + """Lists keys of Azure Machine Learning Workspace's storage account. - :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 Workspace or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.machinelearningservices.models.Workspace] + Lists keys of Azure Machine Learning Workspace's storage account. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: Azure Machine Learning Workspace Name. Required. + :type workspace_name: str + :return: ListStorageAccountKeysResult or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult :raises ~azure.core.exceptions.HttpResponseError: """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.WorkspaceListResult] = kwargs.pop("cls", None) - - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1701,84 +1753,61 @@ def list_by_subscription(self, skip: Optional[str] = None, **kwargs: Any) -> Ite } 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) + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - 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 + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) - def extract_data(pipeline_response): - deserialized = self._deserialize("WorkspaceListResult", 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) + _request = build_list_storage_account_keys_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) - def get_next(next_link=None): - request = prepare_request(next_link) + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response + 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 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 + deserialized = self._deserialize("ListStorageAccountKeysResult", pipeline_response.http_response) - return ItemPaged(get_next, extract_data) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.MachineLearningServices/workspaces" - } + return deserialized # type: ignore @distributed_trace - def list_notebook_access_token( + def list_outbound_network_dependencies_endpoints( # pylint: disable=name-too-long self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.NotebookAccessTokenResult: - """return notebook access token and refresh token. + ) -> _models.ExternalFQDNResponse: + """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. + + Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) + programmatically. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: NotebookAccessTokenResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.NotebookAccessTokenResult + :return: ExternalFQDNResponse or the result of cls(response) + :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1790,23 +1819,21 @@ def list_notebook_access_token( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NotebookAccessTokenResult] = kwargs.pop("cls", None) + cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) - request = build_list_notebook_access_token_request( + _request = build_list_outbound_network_dependencies_endpoints_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_notebook_access_token.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1816,21 +1843,17 @@ def list_notebook_access_token( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("NotebookAccessTokenResult", pipeline_response) + deserialized = self._deserialize("ExternalFQDNResponse", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_notebook_access_token.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookAccessToken" - } + return deserialized # type: ignore def _prepare_notebook_initial( self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> Optional[_models.NotebookResourceInfo]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1842,64 +1865,60 @@ def _prepare_notebook_initial( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.NotebookResourceInfo]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_prepare_notebook_request( + _request = build_prepare_notebook_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._prepare_notebook_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("NotebookResourceInfo", pipeline_response) + 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")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _prepare_notebook_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook" - } + return deserialized # type: ignore @distributed_trace def begin_prepare_notebook( self, resource_group_name: str, workspace_name: str, **kwargs: Any ) -> LROPoller[_models.NotebookResourceInfo]: - """Prepare a notebook. + """Prepare Azure Machine Learning Workspace's notebook resource. + + Prepare Azure Machine Learning Workspace's notebook resource. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_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 NotebookResourceInfo or the result of cls(response) :rtype: @@ -1924,12 +1943,13 @@ def begin_prepare_notebook( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("NotebookResourceInfo", pipeline_response) + deserialized = self._deserialize("NotebookResourceInfo", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1941,100 +1961,18 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.NotebookResourceInfo].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_prepare_notebook.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/prepareNotebook" - } - - @distributed_trace - def list_storage_account_keys( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ListStorageAccountKeysResult: - """List storage account keys of a 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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListStorageAccountKeysResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListStorageAccountKeysResult - :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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ListStorageAccountKeysResult] = kwargs.pop("cls", None) - - request = build_list_storage_account_keys_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_storage_account_keys.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + return LROPoller[_models.NotebookResourceInfo]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - 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("ListStorageAccountKeysResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - list_storage_account_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listStorageAccountKeys" - } - - @distributed_trace - def list_notebook_keys( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ListNotebookKeysResult: - """List keys of a notebook. - - :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 - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ListNotebookKeysResult or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ListNotebookKeysResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { + def _resync_keys_initial(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2046,108 +1984,102 @@ def list_notebook_keys( _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ListNotebookKeysResult] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_list_notebook_keys_request( + _request = build_resync_keys_request( resource_group_name=resource_group_name, workspace_name=workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_notebook_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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("ListNotebookKeysResult", pipeline_response) + 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, deserialized, {}) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore - list_notebook_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/listNotebookKeys" - } + return deserialized # type: ignore @distributed_trace - def list_outbound_network_dependencies_endpoints( - self, resource_group_name: str, workspace_name: str, **kwargs: Any - ) -> _models.ExternalFQDNResponse: - """Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + def begin_resync_keys(self, resource_group_name: str, workspace_name: str, **kwargs: Any) -> LROPoller[None]: + """Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. - Called by Client (Portal, CLI, etc) to get a list of all external outbound dependencies (FQDNs) - programmatically. + Resync all the keys associated with this workspace.This includes keys for the storage account, + app insights and password for container registry. :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. + :param workspace_name: Azure Machine Learning Workspace Name. Required. :type workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ExternalFQDNResponse or the result of cls(response) - :rtype: ~azure.mgmt.machinelearningservices.models.ExternalFQDNResponse + :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: """ - 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: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExternalFQDNResponse] = kwargs.pop("cls", None) - - request = build_list_outbound_network_dependencies_endpoints_request( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_outbound_network_dependencies_endpoints.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **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("ExternalFQDNResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) + 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._resync_keys_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) - return deserialized + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore - list_outbound_network_dependencies_endpoints.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MachineLearningServices/workspaces/{workspaceName}/outboundNetworkDependenciesEndpoints" - } + 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[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/create_or_update.py new file mode 100644 index 00000000000..3c558de1abe --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/create_or_update.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 create_or_update.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.capability_hosts.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="capabilityHostName", + body={ + "properties": { + "customerSubnet": "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroups/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/CapabilityHost/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/delete.py new file mode 100644 index 00000000000..1c9a0e160e9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/delete.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 delete.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", + ) + + client.capability_hosts.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="capabilityHostName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/CapabilityHost/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/get.py new file mode 100644 index 00000000000..4ed702188f5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/capability_host/get.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 get.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.capability_hosts.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="capabilityHostName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/CapabilityHost/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aks_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aks_compute.py index 6dca84bdc7d..a2bd42a5a49 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aks_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aks_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/AKSCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/AKSCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aml_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aml_compute.py index efbef7e090e..096545fc1f3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aml_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/aml_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/AmlCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/AmlCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aks_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aks_compute.py index c4f5100e516..c431dab556e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aks_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aks_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/BasicAKSCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/BasicAKSCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aml_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aml_compute.py index 4e8789e3ef2..3f656a42110 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aml_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_aml_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -55,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/BasicAmlCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/BasicAmlCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_data_factory_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_data_factory_compute.py index 322dec99f0e..d65ea669cf6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_data_factory_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/basic_data_factory_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/BasicDataFactoryCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/BasicDataFactoryCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance.py index d2e8342bc1a..53d0a69757d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,30 +40,50 @@ def main(): "computeType": "ComputeInstance", "properties": { "applicationSharingPolicy": "Personal", + "autologgerSettings": {"mlflowAutologger": "Enabled"}, "computeInstanceAuthorizationType": "personal", "customServices": [ { "docker": {"privileged": True}, - "endpoints": [{"name": "connect", "protocol": "http", "published": 8787, "target": 8787}], - "environmentVariables": {"test_variable": {"type": "local", "value": "test_value"}}, - "image": {"reference": "ghcr.io/azure/rocker-rstudio-ml-verse:latest", "type": "docker"}, - "name": "rstudio", + "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"}, + "kernel": { + "argv": ["option1", "option2", "option3"], + "displayName": "TestKernel", + "language": "python", + }, + "name": "rstudio-workbench", "volumes": [ { - "readOnly": False, - "source": "/home/azureuser/cloudfiles", - "target": "/home/azureuser/cloudfiles", + "readOnly": True, + "source": "/mnt/azureuser/", + "target": "/home/testuser/", "type": "bind", } ], } ], + "enableOSPatching": True, + "enableRootAccess": True, + "enableSSO": True, "personalComputeInstanceSettings": { "assignedUser": { "objectId": "00000000-0000-0000-0000-000000000000", "tenantId": "00000000-0000-0000-0000-000000000000", } }, + "releaseQuotaOnStop": True, "sshSettings": {"sshPublicAccess": "Disabled"}, "subnet": {"id": "test-subnet-resource-id"}, "vmSize": "STANDARD_NC6", @@ -73,6 +94,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/ComputeInstance.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/ComputeInstance.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_minimal.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_minimal.py index 575439d3256..5bf387cf49a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_minimal.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_minimal.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/ComputeInstanceMinimal.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/ComputeInstanceMinimal.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_with_schedules.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_with_schedules.py index 4134df53117..f6f839411e1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_with_schedules.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/compute_instance_with_schedules.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -69,6 +70,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/ComputeInstanceWithSchedules.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/kubernetes_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/kubernetes_compute.py index 07fc5057133..53fab879e38 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/kubernetes_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/create_or_update/kubernetes_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -58,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/createOrUpdate/KubernetesCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/createOrUpdate/KubernetesCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py index 03e8f509fba..eec1ce23048 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aks_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aks_compute.py index 4692f63ff9d..8b1bdd0877b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aks_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aks_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/get/AKSCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/get/AKSCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aml_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aml_compute.py index 59ea7d05e29..6100a24031e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aml_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/aml_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/get/AmlCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/get/AmlCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/compute_instance.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/compute_instance.py index fe66677f719..ba4c77360c0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/compute_instance.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/compute_instance.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/get/ComputeInstance.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/get/ComputeInstance.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/kubernetes_compute.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/kubernetes_compute.py index b09cac4f3f6..2b96a7b198f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/kubernetes_compute.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get/kubernetes_compute.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/get/KubernetesCompute.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/get/KubernetesCompute.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get_allowed_vm_sizes_for_resize.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get_allowed_vm_sizes_for_resize.py new file mode 100644 index 00000000000..ccb58be533d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/get_allowed_vm_sizes_for_resize.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 get_allowed_vm_sizes_for_resize.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.get_allowed_resize_sizes( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/getAllowedVMSizesForResize.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py index 884ceeb73b5..39956c3dfc1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_keys.py index ed185cc8032..87f2a5b6384 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_nodes.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_nodes.py index 66ee6a0f4be..ce3bc01031c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_nodes.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/list_nodes.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/listNodes.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/listNodes.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py index 344934f7929..14609f1863e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/patch.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/patch.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/patch.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/resize.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/resize.py new file mode 100644 index 00000000000..2158e526bb2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/resize.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 resize.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", + ) + + client.compute.begin_resize( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + parameters={"targetVMSize": "Standard_DS11_v2"}, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/resize.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py index 6f314eb40ed..8662c420083 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/restart.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/restart.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/restart.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py index 9e6d787b739..0640d49ba0e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/start.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/start.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/start.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py index 431311991b6..75976be299e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/stop.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Compute/stop.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/stop.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_custom_services.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_custom_services.py new file mode 100644 index 00000000000..aef52e5b277 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/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", + ) + + 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"} + ], + } + ], + ) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/updateCustomServices.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_data_mounts.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_data_mounts.py new file mode 100644 index 00000000000..a92ff3449d3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_data_mounts.py @@ -0,0 +1,52 @@ +# 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_data_mounts.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", + ) + + client.compute.update_data_mounts( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + data_mounts=[ + { + "mountAction": "Mount", + "mountMode": "ReadOnly", + "mountName": "hello", + "mountPath": "/some/random/path/on/host", + "source": "azureml://subscriptions/some-sub/resourcegroups/some-rg/workspaces/some-ws/data/some-data-asset-name/versions/some-data-asset-version", + "sourceType": "URI", + } + ], + ) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/updateDataMounts.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_idle_shutdown_setting.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/update_idle_shutdown_setting.py new file mode 100644 index 00000000000..e932c69629c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/compute/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", + ) + + client.compute.update_idle_shutdown_setting( + resource_group_name="testrg123", + workspace_name="workspaces123", + compute_name="compute123", + parameters={"idleTimeBeforeShutdown": "PT120M"}, + ) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Compute/updateIdleShutdownSetting.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/data_reference/get_blob_reference_sas.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/data_reference/get_blob_reference_sas.py new file mode 100644 index 00000000000..707c98ad2c9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/data_reference/get_blob_reference_sas.py @@ -0,0 +1,45 @@ +# 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_blob_reference_sas.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.registry_data_references.get_blob_reference_sas( + resource_group_name="test-rg", + registry_name="registryName", + name="string", + version="string", + body={"assetId": "string", "blobUri": "https://www.contoso.com/example"}, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/DataReference/getBlobReferenceSAS.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_blob_waccount_key/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_blob_waccount_key/create_or_update.py index f51f887bbd5..37760814e05 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_blob_waccount_key/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_blob_waccount_key/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/AzureBlobWAccountKey/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/AzureBlobWAccountKey/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen1_wservice_principal/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen1_wservice_principal/create_or_update.py index bfbb9e2ecda..c2bd5bab3e4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen1_wservice_principal/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen1_wservice_principal/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -54,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/AzureDataLakeGen1WServicePrincipal/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/AzureDataLakeGen1WServicePrincipal/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen2_wservice_principal/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen2_wservice_principal/create_or_update.py index d221f467362..2a91157ca7d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen2_wservice_principal/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_data_lake_gen2_wservice_principal/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -57,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/AzureDataLakeGen2WServicePrincipal/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/AzureDataLakeGen2WServicePrincipal/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_file_waccount_key/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_file_waccount_key/create_or_update.py index 0ae6c4a4789..ca1328f1d99 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_file_waccount_key/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/azure_file_waccount_key/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -53,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/AzureFileWAccountKey/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/AzureFileWAccountKey/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py index 78dd652ab71..35a79205550 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py index 93e17e5a099..ef4d1820bb9 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py index 4b5de229b6e..dd8ebc048f0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list_secrets.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list_secrets.py index 74fe51d50b3..e39938cc6cd 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list_secrets.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/datastore/list_secrets.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Datastore/listSecrets.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Datastore/listSecrets.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/create.py new file mode 100644 index 00000000000..74de6fc0028 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/create.py @@ -0,0 +1,50 @@ +# 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.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.endpoint.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + body={ + "properties": { + "associatedResourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/test-rg/providers/Microsoft.CognitiveService/account/account-1", + "endpointType": "Azure.OpenAI", + "name": "Azure.OpenAI", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/create.py new file mode 100644 index 00000000000..3073bf8847f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/create.py @@ -0,0 +1,51 @@ +# 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.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.endpoint_deployment.begin_create_or_update( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + endpoint_name="Azure.OpenAI", + deployment_name="text-davinci-003", + body={ + "properties": { + "model": {"format": "OpenAI", "name": "text-davinci-003", "version": "1"}, + "type": "Azure.OpenAI", + "versionUpgradeOption": "OnceNewDefaultVersionAvailable", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/Deployment/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/delete.py new file mode 100644 index 00000000000..ab550991edd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/delete.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 delete.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", + ) + + client.endpoint_deployment.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + deployment_name="testDeploymentName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/Deployment/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get.py new file mode 100644 index 00000000000..b47bc4c9940 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get.py @@ -0,0 +1,44 @@ +# 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.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.endpoint_deployment.get( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + endpoint_name="Azure.OpenAI", + deployment_name="text-davinci-003", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/Deployment/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_deployments.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_deployments.py new file mode 100644 index 00000000000..1cfc466fc0d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_deployments.py @@ -0,0 +1,44 @@ +# 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_deployments.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.endpoint_deployment.list( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + endpoint_name="Azure.OpenAI", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/Deployment/getDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_in_workspace.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_in_workspace.py new file mode 100644 index 00000000000..f3386661d66 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/deployment/get_in_workspace.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 get_in_workspace.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.endpoint_deployment.get_in_workspace( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/Deployment/getInWorkspace.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get.py new file mode 100644 index 00000000000..9326fc810dd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get.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 get.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.endpoint.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get_models.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get_models.py new file mode 100644 index 00000000000..21fec6e488c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/get_models.py @@ -0,0 +1,44 @@ +# 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_models.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.endpoint.get_models( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/getModels.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list.py new file mode 100644 index 00000000000..eefaf10b7c1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list.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 list.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.endpoint.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list_keys.py new file mode 100644 index 00000000000..65b3aabdc74 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/list_keys.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 list_keys.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.endpoint.list_keys( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/listKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/create.py new file mode 100644 index 00000000000..db68fede3d2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/create.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.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.rai_policy.begin_create( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + rai_policy_name="raiPolicyName", + body={ + "properties": { + "basePolicyName": "112", + "completionBlocklists": [{"blocking": False, "blocklistName": "blocklistName"}], + "contentFilters": [ + { + "allowedContentLevel": "Low", + "blocking": False, + "enabled": False, + "name": "policyName", + "source": "Prompt", + } + ], + "mode": "Blocking", + "promptBlocklists": [{"blocking": False, "blocklistName": "blocklistName"}], + "type": "SystemManaged", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/RaiPolicy/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/delete.py new file mode 100644 index 00000000000..5b37da3681f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/delete.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 delete.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", + ) + + client.rai_policy.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + rai_policy_name="raiPolicyName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/RaiPolicy/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/get.py new file mode 100644 index 00000000000..9632997a83c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/get.py @@ -0,0 +1,44 @@ +# 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.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.rai_policy.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + rai_policy_name="raiPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/RaiPolicy/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/list.py new file mode 100644 index 00000000000..9321159ffe2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/rai_policy/list.py @@ -0,0 +1,44 @@ +# 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.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.rai_policies.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/RaiPolicy/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/regenerate_key.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/regenerate_key.py new file mode 100644 index 00000000000..8875f229a43 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/endpoint/regenerate_key.py @@ -0,0 +1,44 @@ +# 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 regenerate_key.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.endpoint.regenerate_keys( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + endpoint_name="Azure.OpenAI", + body={"keyName": "Key1"}, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Endpoint/regenerateKey.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/external_fqdn/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/external_fqdn/get.py index aa82632feff..ecf07478b8b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/external_fqdn/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/external_fqdn/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/ExternalFQDN/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ExternalFQDN/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/get.py new file mode 100644 index 00000000000..5d3172d3174 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/get.py @@ -0,0 +1,45 @@ +# 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.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.features.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + featureset_name="string", + featureset_version="string", + feature_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Feature/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/list.py new file mode 100644 index 00000000000..1c993c9ceaf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/feature/list.py @@ -0,0 +1,45 @@ +# 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.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.features.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + featureset_name="string", + featureset_version="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Feature/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/get_delta_models_status_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/get_delta_models_status_async.py new file mode 100644 index 00000000000..b74f9c54653 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/get_delta_models_status_async.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 get_delta_models_status_async.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.inference_groups.get_delta_models_status_async( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + body={ + "deltaModels": ["string"], + "targetBaseModel": "azureml://registries/test-registry/models/modelabc/versions/1", + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/InferenceGroup/getDeltaModelsStatusAsync.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/list_delta_models_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/list_delta_models_async.py new file mode 100644 index 00000000000..bc56be3be4a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/list_delta_models_async.py @@ -0,0 +1,50 @@ +# 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_delta_models_async.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.inference_groups.list_delta_models_async( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + body={ + "count": -1, + "skipToken": "string", + "targetBaseModel": "azureml://registries/test-registry/models/modelabc/versions/1", + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/InferenceGroup/listDeltaModelsAsync.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/modify_delta_models_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/modify_delta_models_async.py new file mode 100644 index 00000000000..28be334be6a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/inference_group/modify_delta_models_async.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 modify_delta_models_async.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", + ) + + client.inference_groups.begin_modify_delta_models_async( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + body={ + "addDeltaModels": ["string"], + "removeDeltaModels": ["string"], + "targetBaseModel": "azureml://registries/test-registry/models/modelabc/versions/1", + }, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/InferenceGroup/modifyDeltaModelsAsync.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/create_or_update.py index 47f02ffa053..0ff720960de 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -81,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/AutoMLJob/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/AutoMLJob/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/get.py index 5744ad654a7..cd0e991a6e1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/AutoMLJob/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/AutoMLJob/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/list.py index 2b84eaeaa4e..6c2d55fad9e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/auto_ml_job/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/AutoMLJob/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/AutoMLJob/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py index 92009c44617..f2bcac80d04 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/cancel.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/cancel.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/cancel.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/create_or_update.py index d37efcce8ad..31a3b383e89 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -77,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/CommandJob/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/CommandJob/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/get.py index da20b17f687..8192611d73e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/CommandJob/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/CommandJob/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/list.py index 603f7bbbc41..48bfcac24dc 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/command_job/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/CommandJob/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/CommandJob/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py index 80e82b2866e..0007e8889bf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/create_or_update.py new file mode 100644 index 00000000000..83958d48455 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/create_or_update.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.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.jobs.create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + id="string", + body={ + "properties": { + "computeId": "gpu-compute", + "experimentName": "llm-finetuning", + "fineTuningDetails": { + "model": { + "description": None, + "jobInputType": "mlflow_model", + "mode": "ReadOnlyMount", + "uri": "azureml://registries/azureml-meta/models/Llama-2-7b/versions/11", + }, + "modelProvider": "Custom", + "taskType": "TextCompletion", + "trainingData": { + "description": None, + "jobInputType": "uri_file", + "mode": "ReadOnlyMount", + "uri": "azureml://registries/azureml-meta/models/Llama-2-7b/versions/11", + }, + }, + "jobType": "FineTuning", + "outputs": { + "string": { + "description": "string", + "jobOutputType": "mlflow_model", + "mode": "ReadWriteMount", + "uri": "string", + } + }, + "queueSettings": {"jobTier": "Standard"}, + "resources": {"instanceTypes": ["Standard_NC6"]}, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/FineTuningJob/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/get.py new file mode 100644 index 00000000000..3eac2e1108a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/get.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 get.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.jobs.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + id="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/FineTuningJob/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/list.py new file mode 100644 index 00000000000..458fe13c884 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/fine_tuning_job/list.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 list.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.jobs.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/FineTuningJob/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/create_or_update.py index 8d093b05a24..6262e93eb56 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -61,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/PipelineJob/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/PipelineJob/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/get.py index 69dd018de1a..055022573af 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/PipelineJob/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/PipelineJob/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/list.py index 2ee9adaf0c1..69ed267e914 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/pipeline_job/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/PipelineJob/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/PipelineJob/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/create_or_update.py index 39198f670f4..c0e1bb03e65 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -78,6 +79,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/SweepJob/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/SweepJob/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/get.py index 4c424fedc4e..2cbbe603cba 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/SweepJob/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/SweepJob/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/list.py index 3081f0d1b58..2fba92fca87 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/job/sweep_job/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Job/SweepJob/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Job/SweepJob/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/create_or_update_rule.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/create_or_update_rule.py new file mode 100644 index 00000000000..e9a296bce67 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/create_or_update_rule.py @@ -0,0 +1,51 @@ +# 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_rule.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.managed_network_settings_rule.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + rule_name="rule_name_1", + body={ + "properties": { + "category": "UserDefined", + "destination": "destination_endpoint", + "status": "Active", + "type": "FQDN", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ManagedNetwork/createOrUpdateRule.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/delete_rule.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/delete_rule.py new file mode 100644 index 00000000000..c102a23c53b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/delete_rule.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 delete_rule.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", + ) + + client.managed_network_settings_rule.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + rule_name="rule-name", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ManagedNetwork/deleteRule.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/get_rule.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/get_rule.py new file mode 100644 index 00000000000..92c95e2dcb1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/get_rule.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 get_rule.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.managed_network_settings_rule.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + rule_name="name_of_the_fqdn_rule", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ManagedNetwork/getRule.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/list_rule.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/list_rule.py new file mode 100644 index 00000000000..0a111387d4d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/list_rule.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 list_rule.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.managed_network_settings_rule.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ManagedNetwork/listRule.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/provision.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/provision.py new file mode 100644 index 00000000000..8d08d6ae976 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/managed_network/provision.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 provision.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.managed_network_provisions.begin_provision_managed_network( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/ManagedNetwork/provision.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/list_keys.py index 66a02eb6b46..8844fb5a4f9 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Notebook/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Notebook/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py index 009f750c227..a48b6e62e77 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/notebook/prepare.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Notebook/prepare.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Notebook/prepare.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/get_logs.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/get_logs.py index 2bae655720a..d992648ea71 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/get_logs.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/get_logs.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/getLogs.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/getLogs.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/create_or_update.py index da3956267da..8ae8612cb4e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -74,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/KubernetesOnlineDeployment/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/KubernetesOnlineDeployment/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/get.py index bccba8918be..7bdc4f67c3d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/KubernetesOnlineDeployment/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/KubernetesOnlineDeployment/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/list_skus.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/list_skus.py index 532af7db70b..dd4956376a9 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/list_skus.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/list_skus.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/KubernetesOnlineDeployment/listSkus.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/KubernetesOnlineDeployment/listSkus.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/update.py index ef4bd08cf87..c92e051ae3a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/kubernetes_online_deployment/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -42,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/KubernetesOnlineDeployment/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/KubernetesOnlineDeployment/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/list.py index 7df4af07040..f37608c4082 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/create_or_update.py index c890a3f5527..ff39d24b5b6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -77,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/ManagedOnlineDeployment/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/ManagedOnlineDeployment/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/get.py index ccfa935e7f4..dafd2c57ab5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/ManagedOnlineDeployment/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/ManagedOnlineDeployment/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/list_skus.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/list_skus.py index ef2b493c784..e8769639bbb 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/list_skus.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/list_skus.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/ManagedOnlineDeployment/listSkus.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/ManagedOnlineDeployment/listSkus.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/update.py index e7ec5681f71..79588857d8f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/online_deployment/managed_online_deployment/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -42,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/OnlineDeployment/ManagedOnlineDeployment/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/OnlineDeployment/ManagedOnlineDeployment/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/create_or_update.py index 4f95d6a5bde..57eef3bca7e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -33,13 +34,13 @@ def main(): resource_group_name="rg-1234", workspace_name="testworkspace", private_endpoint_connection_name="{privateEndpointConnectionName}", - properties={ + body={ "properties": {"privateLinkServiceConnectionState": {"description": "Auto-Approved", "status": "Approved"}} }, ) print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/PrivateEndpointConnection/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/PrivateEndpointConnection/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/delete.py index d071ba7e4df..457ce052e2f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/PrivateEndpointConnection/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/PrivateEndpointConnection/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/get.py index f3a4e42b1c2..e720b91bc4a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/PrivateEndpointConnection/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/PrivateEndpointConnection/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/list.py index 8a893d04e41..1aee400b40b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_endpoint_connection/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/PrivateEndpointConnection/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/PrivateEndpointConnection/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_link_resource/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_link_resource/list.py index 71a768ec1c8..8e1e70d6659 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_link_resource/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/private_link_resource/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -33,9 +34,10 @@ def main(): resource_group_name="rg-1234", workspace_name="testworkspace", ) - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/PrivateLinkResource/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/PrivateLinkResource/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py index ba614e993d1..c0acc8e3eec 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Quota/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Quota/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py index d135e3ae3a5..37f8e7d6cd6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/quota/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -51,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Quota/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Quota/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_system_created.py index 577787fee2b..12b5dba086a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_system_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_system_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -91,6 +92,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/createOrUpdate-SystemCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/createOrUpdate-SystemCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_user_created.py index 4fb0f626522..1b8fff43f30 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_user_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/create_or_update_user_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -75,6 +76,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/createOrUpdate-UserCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/createOrUpdate-UserCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py index 2e4a8a929e4..7d7b396b1df 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_system_created.py index fd5b114248b..ba9fc8a901e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_system_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_system_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/get-SystemCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/get-SystemCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_user_created.py index bd86983df7e..20d21b0abf7 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_user_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/get_user_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/get-UserCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/get-UserCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_by_subscription.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_by_subscription.py index d017c80aa22..1ba44adfa3e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_by_subscription.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/listBySubscription.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/listBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_system_created.py index d9ef5482f59..7fbef0535ff 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_system_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_system_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/list-SystemCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/list-SystemCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_user_created.py index 193089df517..9945c43afaf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_user_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/list_user_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/list-UserCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/list-UserCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/remove_regions.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/remove_regions.py index 75dd8c55aac..4bba6d82835 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/remove_regions.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/remove_regions.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -93,6 +94,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/removeRegions.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/removeRegions.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_system_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_system_created.py index bda97b4ad6d..2e75043c994 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_system_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_system_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/update-SystemCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/update-SystemCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_user_created.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_user_created.py index d8ecdb855c2..c0e89b7ab0f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_user_created.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registries/update_user_created.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registries/update-UserCreated.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registries/update-UserCreated.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/create_or_update.py index 3b5010d9d18..4786a003b7d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/delete.py index b72a96432c9..ae2a32b0716 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/get.py index c8b1ce0c2a7..150a184fec8 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/list.py index 8f5972265e0..b1817c9cf09 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_get_start_pending_upload.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_get_start_pending_upload.py index e3e974c61eb..4f16cfd6e6b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_get_start_pending_upload.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_get_start_pending_upload.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeVersion/createOrGetStartPendingUpload.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeVersion/createOrGetStartPendingUpload.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_update.py index 1df9f062fc2..5fd79c5b383 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/delete.py index 3e012305c57..8e558ebb386 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/get.py index f62658b6337..c1bb44870db 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/list.py index 4453204ec59..7c21f038ff6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/code_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/CodeVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/CodeVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/create_or_update.py index 6c3efd5e6a1..89b5df11f05 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/delete.py index aea7dc0c0de..0325774b590 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/get.py index 652246d7741..f4b74ea06b3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/list.py index af03b40d648..b1b77d3a475 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/create_or_update.py index 3ef241cc2c8..b76ea2ffb0b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/delete.py index 24e8ba968dc..647f64b9f91 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/get.py index 906686be462..75b60025228 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/list.py index 39d93fd0de0..715a6fa8e57 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/component_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ComponentVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ComponentVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/create_or_update.py index 2619016ab13..1dd4c665c87 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/delete.py index db9823083c3..cc9534838c5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/get.py index cd457746f17..7f8c31c99d5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/registry_list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/registry_list.py index 1b5917eb34e..743bc8b3430 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/registry_list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_container/registry_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataContainer/registryList.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataContainer/registryList.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_get_start_pending_upload.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_get_start_pending_upload.py index 9142baba5fa..4d24a9c91ba 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_get_start_pending_upload.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_get_start_pending_upload.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataVersionBase/createOrGetStartPendingUpload.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataVersionBase/createOrGetStartPendingUpload.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_update.py index 01da03f03e1..7adcf9bfc2d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataVersionBase/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataVersionBase/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/delete.py index d8772f5b25d..16f94920085 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataVersionBase/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataVersionBase/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/get.py index fdf5e3b6453..ab6dd2f8b7c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataVersionBase/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataVersionBase/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/registry_list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/registry_list.py index 54d19354ab1..931323feb6e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/registry_list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/data_version_base/registry_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/DataVersionBase/registryList.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/DataVersionBase/registryList.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/create_or_update.py index 931d285c42d..1e02dc1086c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/delete.py index 098883e9fff..3c1089c672d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/get.py index bc742dec3e1..f3c4fb5a6ca 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/list.py index 75d05a51b95..fb05d0e3de6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_get_start_pending_upload.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_get_start_pending_upload.py index a24b5011914..9857573a81b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_get_start_pending_upload.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_get_start_pending_upload.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelVersion/createOrGetStartPendingUpload.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelVersion/createOrGetStartPendingUpload.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_update.py index a2caeebafdd..86f48a6e6bf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/delete.py index 243da0a3dc5..50049d932af 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/get.py index 3f718017c06..15a3a6c4b34 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/list.py index ca64f031391..7151971835c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/registry/model_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Registry/ModelVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Registry/ModelVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/create_or_update.py index 351a1bcdea5..bb7a5d10f11 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -57,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Schedule/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Schedule/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py index 69da5de82fe..48b424a4df4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Schedule/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Schedule/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py index 7772e8800fa..d2a18d27b82 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Schedule/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Schedule/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py index 0610eab1d68..678d1ec0132 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/schedule/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Schedule/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Schedule/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py index ccff07e2fa3..c353ae2479e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/usage/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Usage/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Usage/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/virtual_machine_size/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/virtual_machine_size/list.py index e84b655dbd1..68bc379efb1 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/virtual_machine_size/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/virtual_machine_size/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/VirtualMachineSize/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/VirtualMachineSize/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/create_or_update.py index 64b1e00ff40..879951df618 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -66,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchDeployment/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchDeployment/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/delete.py index e4e9b5706e4..b68f801a99e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchDeployment/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchDeployment/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/get.py index d1617e80989..5f9467fb140 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchDeployment/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchDeployment/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/list.py index f1242ba35f7..735384c01b0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchDeployment/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchDeployment/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/update.py index 102b3fe0734..8659d8b406e 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_deployment/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchDeployment/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchDeployment/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/create_or_update.py index 2074040353b..413bc0e0007 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/delete.py index 80701cf2af6..f7b6e2cc778 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/get.py index 990f55858ae..819999c849f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list.py index e3e3fe7fd1d..6a90ce17944 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list_keys.py index cc96bcdff69..0325b846a4f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/update.py index f6725836e68..dce746d4e8b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/batch_endpoint/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/BatchEndpoint/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/BatchEndpoint/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/create_or_update.py index af061e818d4..d66a6266465 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/delete.py index 7da2cb51b90..012343be376 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/get.py index f56a7a87e66..d9d226a0b00 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/list.py index 001ce2be857..846e343c1d5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_get_start_pending_upload.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_get_start_pending_upload.py index cea171e25bf..7b8e1bfce0c 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_get_start_pending_upload.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_get_start_pending_upload.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeVersion/createOrGetStartPendingUpload.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/createOrGetStartPendingUpload.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_update.py index b894f4bda5f..f0f5703cc30 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/delete.py index c78c15a8ed4..de31b0ad98d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/get.py index ecae464c771..889ba2b6607 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/list.py index 52a9742de54..51d59a19507 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/CodeVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/publish.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/publish.py new file mode 100644 index 00000000000..35e083aa98f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/code_version/publish.py @@ -0,0 +1,44 @@ +# 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 publish.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", + ) + + client.code_versions.begin_publish( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={"destinationName": "string", "destinationVersion": "string", "registryName": "string"}, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/CodeVersion/publish.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/create_or_update.py index 1c6f64c469e..b66a338e151 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/delete.py index 8826100a38e..48bf0de8170 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/get.py index 3954753f23a..f6935ac1aad 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/list.py index 45d349e330c..00504413a10 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/create_or_update.py index 724e7b3e919..b0768b7fd81 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/delete.py index e3fe021ae63..d6b2a0a3319 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/get.py index 5d23ed45e90..27b66c6ec9d 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/list.py index aaecb70ad47..f500bb0809f 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ComponentVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/publish.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/publish.py new file mode 100644 index 00000000000..3cf40b4a8f4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/component_version/publish.py @@ -0,0 +1,44 @@ +# 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 publish.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", + ) + + client.component_versions.begin_publish( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={"destinationName": "string", "destinationVersion": "string", "registryName": "string"}, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ComponentVersion/publish.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py index cd04a676e0e..1a2b56de6b4 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -32,7 +33,7 @@ def main(): response = client.workspaces.begin_create_or_update( resource_group_name="workspace-1234", workspace_name="testworkspace", - parameters={ + body={ "identity": { "type": "SystemAssigned,UserAssigned", "userAssignedIdentities": { @@ -76,6 +77,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/create.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/create.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/create_or_update.py index 98d366c715e..4f738dc0b73 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -45,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/delete.py index a135c9b5d42..b6a10c9f778 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/get.py index 53ef7b99be9..3353bef04da 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/list.py index 3d48472b6ce..f02448be17a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/create_or_update.py index 8705b06141a..647053846cf 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -48,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataVersionBase/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataVersionBase/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/delete.py index 4b7c673a523..e456a0a32a9 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataVersionBase/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataVersionBase/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/get.py index d0e194b5599..298720f36e7 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataVersionBase/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataVersionBase/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/list.py index 72bb1bc4b0e..90a90ba06ad 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/DataVersionBase/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataVersionBase/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/publish.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/publish.py new file mode 100644 index 00000000000..997864e3674 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/data_version_base/publish.py @@ -0,0 +1,44 @@ +# 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 publish.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", + ) + + client.data_versions.begin_publish( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={"destinationName": "string", "destinationVersion": "string", "registryName": "string"}, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/DataVersionBase/publish.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py index 205bca6f2e8..694e802c421 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py index 3077375cd45..c118c59b622 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/diagnose.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/diagnose.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/diagnose.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/create_or_update.py new file mode 100644 index 00000000000..e1b343763f2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/create_or_update.py @@ -0,0 +1,51 @@ +# 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.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.featureset_containers.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={ + "properties": { + "description": "string", + "isArchived": False, + "properties": {"string": "string"}, + "tags": {"string": "string"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetContainer/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/delete.py new file mode 100644 index 00000000000..b8d7fb9aa69 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/delete.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 delete.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", + ) + + client.featureset_containers.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetContainer/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/get_entity.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/get_entity.py new file mode 100644 index 00000000000..f49504783ba --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/get_entity.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 get_entity.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.featureset_containers.get_entity( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetContainer/getEntity.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/list.py new file mode 100644 index 00000000000..3d2b86a9593 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_container/list.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 list.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.featureset_containers.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetContainer/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/backfill.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/backfill.py new file mode 100644 index 00000000000..660a462e6ec --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/backfill.py @@ -0,0 +1,57 @@ +# 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 backfill.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.featureset_versions.begin_backfill( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={ + "dataAvailabilityStatus": ["None"], + "description": "string", + "displayName": "string", + "featureWindow": { + "featureWindowEnd": "2020-01-01T12:34:56.999+00:51", + "featureWindowStart": "2020-01-01T12:34:56.999+00:51", + }, + "jobId": "string", + "resource": {"instanceType": "string"}, + "sparkConfiguration": {"string": "string"}, + "tags": {"string": "string"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetVersion/backfill.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/create_or_update.py new file mode 100644 index 00000000000..4954238326d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/create_or_update.py @@ -0,0 +1,71 @@ +# 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.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.featureset_versions.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={ + "properties": { + "description": "string", + "entities": ["string"], + "isAnonymous": False, + "isArchived": False, + "materializationSettings": { + "notification": {"emailOn": ["JobFailed"], "emails": ["string"]}, + "resource": {"instanceType": "string"}, + "schedule": { + "endTime": "string", + "frequency": "Day", + "interval": 1, + "schedule": {"hours": [1], "minutes": [1], "monthDays": [1], "weekDays": ["Monday"]}, + "startTime": "string", + "timeZone": "string", + "triggerType": "Recurrence", + }, + "sparkConfiguration": {"string": "string"}, + "storeType": "Online", + }, + "properties": {"string": "string"}, + "specification": {"path": "string"}, + "stage": "string", + "tags": {"string": "string"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetVersion/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/delete.py new file mode 100644 index 00000000000..64d010cc901 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/delete.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 delete.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", + ) + + client.featureset_versions.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetVersion/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/get.py new file mode 100644 index 00000000000..d4fd3f4392e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/get.py @@ -0,0 +1,44 @@ +# 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.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.featureset_versions.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetVersion/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/list.py new file mode 100644 index 00000000000..ae98f8e5e01 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featureset_version/list.py @@ -0,0 +1,44 @@ +# 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.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.featureset_versions.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturesetVersion/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/create_or_update.py new file mode 100644 index 00000000000..6d25f13a93e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/create_or_update.py @@ -0,0 +1,51 @@ +# 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.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.featurestore_entity_containers.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={ + "properties": { + "description": "string", + "isArchived": False, + "properties": {"string": "string"}, + "tags": {"string": "string"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityContainer/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/delete.py new file mode 100644 index 00000000000..1a6a316f5da --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/delete.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 delete.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", + ) + + client.featurestore_entity_containers.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityContainer/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/get_entity.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/get_entity.py new file mode 100644 index 00000000000..ab8d390ee4b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/get_entity.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 get_entity.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.featurestore_entity_containers.get_entity( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityContainer/getEntity.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/list.py new file mode 100644 index 00000000000..f16f46a2283 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_container/list.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 list.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.featurestore_entity_containers.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityContainer/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/create_or_update.py new file mode 100644 index 00000000000..790f8d785ad --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/create_or_update.py @@ -0,0 +1,54 @@ +# 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.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.featurestore_entity_versions.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={ + "properties": { + "description": "string", + "indexColumns": [{"columnName": "string", "dataType": "Datetime"}], + "isAnonymous": False, + "isArchived": False, + "properties": {"string": "string"}, + "tags": {"string": "string"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityVersion/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/delete.py new file mode 100644 index 00000000000..a3afcf2a094 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/delete.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 delete.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", + ) + + client.featurestore_entity_versions.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityVersion/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/get.py new file mode 100644 index 00000000000..b7904837458 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/get.py @@ -0,0 +1,44 @@ +# 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.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.featurestore_entity_versions.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityVersion/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/list.py new file mode 100644 index 00000000000..354d1c67d3c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/featurestore_entity_version/list.py @@ -0,0 +1,44 @@ +# 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.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.featurestore_entity_versions.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/FeaturestoreEntityVersion/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py index 4c2f399080e..7b0dbbc30b2 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/create_or_update.py new file mode 100644 index 00000000000..b909c7280e6 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/create_or_update.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 create_or_update.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.inference_endpoints.begin_create_or_update( + resource_group_name="test-rg1", + workspace_name="my-aml-workspace", + pool_name="string", + endpoint_name="testEndpointName", + body={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "authMode": "AAD", + "description": "string", + "groupName": "string", + "properties": [{"key": "string", "value": "string"}], + "requestConfiguration": {"maxConcurrentRequestsPerInstance": 1, "requestTimeout": "PT5M"}, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Standard"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceEndpoint/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/delete.py new file mode 100644 index 00000000000..2a73b738dd9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/delete.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 delete.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", + ) + + client.inference_endpoints.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + endpoint_name="testEndpointName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceEndpoint/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/get.py new file mode 100644 index 00000000000..372f90f411a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/get.py @@ -0,0 +1,44 @@ +# 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.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.inference_endpoints.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + endpoint_name="testEndpointName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceEndpoint/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/list.py new file mode 100644 index 00000000000..dd0cdab3946 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/list.py @@ -0,0 +1,44 @@ +# 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.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.inference_endpoints.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceEndpoint/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/update.py new file mode 100644 index 00000000000..eeb35e15307 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_endpoint/update.py @@ -0,0 +1,45 @@ +# 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.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.inference_endpoints.begin_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + endpoint_name="testEndpointName", + body={"tags": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceEndpoint/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/create_or_update.py new file mode 100644 index 00000000000..d72abbe40cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/create_or_update.py @@ -0,0 +1,83 @@ +# 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.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.inference_groups.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + body={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "description": "string", + "environmentConfiguration": { + "environmentId": "azureml://registries/test-registry/models/enginefeed/versions/1", + "environmentVariables": [{"key": "string", "value": "string"}], + "livenessProbe": { + "failureThreshold": 1, + "initialDelay": "PT5M", + "period": "PT5M", + "successThreshold": 1, + "timeout": "PT5M", + }, + "readinessProbe": { + "failureThreshold": 1, + "initialDelay": "PT5M", + "period": "PT5M", + "successThreshold": 1, + "timeout": "PT5M", + }, + "startupProbe": { + "failureThreshold": 1, + "initialDelay": "PT5M", + "period": "PT5M", + "successThreshold": 1, + "timeout": "PT5M", + }, + }, + "modelConfiguration": {"modelId": "azureml://registries/test-registry/models/modelabc/versions/1"}, + "nodeSkuType": "string", + "properties": [{"key": "string", "value": "string"}], + "scaleUnitSize": 1, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Free"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/delete.py new file mode 100644 index 00000000000..807dfa79fae --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/delete.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 delete.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", + ) + + client.inference_groups.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get.py new file mode 100644 index 00000000000..bb4e6b4474d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get.py @@ -0,0 +1,44 @@ +# 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.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.inference_groups.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get_status.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get_status.py new file mode 100644 index 00000000000..5a153d11d5c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/get_status.py @@ -0,0 +1,44 @@ +# 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_status.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.inference_groups.get_status( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/getStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list.py new file mode 100644 index 00000000000..44b3ff68817 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list.py @@ -0,0 +1,44 @@ +# 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.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.inference_groups.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list_skus.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list_skus.py new file mode 100644 index 00000000000..18ec7fc56c2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/list_skus.py @@ -0,0 +1,45 @@ +# 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_skus.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.inference_groups.list_skus( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/listSkus.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/update.py new file mode 100644 index 00000000000..fd3c5275bf4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_group/update.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.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.inference_groups.begin_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + pool_name="string", + group_name="string", + body={ + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Standard"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferenceGroup/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/create_or_update.py new file mode 100644 index 00000000000..7755f87ba6a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/create_or_update.py @@ -0,0 +1,55 @@ +# 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.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.inference_pools.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + inference_pool_name="string", + body={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "description": "string", + "properties": [{"key": "string", "value": "string"}], + "scaleUnitConfiguration": {"disablePublicEgress": False, "registries": ["string", "registryName1"]}, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Free"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferencePool/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/delete.py new file mode 100644 index 00000000000..db3603b499c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/delete.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 delete.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", + ) + + client.inference_pools.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + inference_pool_name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferencePool/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get.py new file mode 100644 index 00000000000..a8e16aac108 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/get.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 get.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.inference_pools.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + inference_pool_name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferencePool/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list.py new file mode 100644 index 00000000000..e82b9ea3d2c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/list.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 list.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.inference_pools.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferencePool/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/update.py new file mode 100644 index 00000000000..0a3914bc7ac --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/inference_pool/update.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.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.inference_pools.begin_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + inference_pool_name="string", + body={ + "identity": {"type": "UserAssigned", "userAssignedIdentities": {"string": {}}}, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Standard"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/InferencePool/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_resource_group.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_resource_group.py index 48ad1779487..dc90985ef37 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_resource_group.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/listByResourceGroup.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/listByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_subscription.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_subscription.py index 921bfb2b59f..62734da18b6 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_subscription.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/listBySubscription.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/listBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_keys.py index 9e0e183e60e..a96bdf1b0cb 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_notebook_access_token.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_notebook_access_token.py index d180f3ee30c..2826f0ad63a 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_notebook_access_token.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_notebook_access_token.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/listNotebookAccessToken.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/listNotebookAccessToken.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_storage_account_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_storage_account_keys.py index dbc963513d8..ab386be01c5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_storage_account_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/list_storage_account_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/listStorageAccountKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/listStorageAccountKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/create_or_update.py new file mode 100644 index 00000000000..c8f277bfa3f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/create_or_update.py @@ -0,0 +1,44 @@ +# 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.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.marketplace_subscriptions.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={"properties": {"modelId": "string"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/MarketplaceSubscription/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.py new file mode 100644 index 00000000000..c932422e006 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/delete.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 delete.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", + ) + + client.marketplace_subscriptions.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/MarketplaceSubscription/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/get.py new file mode 100644 index 00000000000..28d71fd3f2b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/get.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 get.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.marketplace_subscriptions.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/MarketplaceSubscription/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/list.py new file mode 100644 index 00000000000..c68748d5347 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/marketplace_subscription/list.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 list.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.marketplace_subscriptions.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/MarketplaceSubscription/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/create_or_update.py index 3c3a3ce3aaf..b9f892c5021 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelContainer/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelContainer/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/delete.py index 7a5a7947d5a..cf4d11a3ee0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelContainer/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelContainer/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/get.py index 9a5d2fcc742..a65e789fb50 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelContainer/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelContainer/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/list.py index 988fdad83e1..e3ddc7c5343 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_container/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelContainer/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelContainer/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/create_or_update.py index 0d9996be1fb..3b98cf1e284 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -49,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelVersion/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelVersion/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/delete.py index ddf28eee552..f23239dbe72 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelVersion/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelVersion/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/get.py index 3322b849163..5fa6d8907b5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelVersion/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelVersion/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/list.py index b6fe6cc09d9..1cd24b11640 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/ModelVersion/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelVersion/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/publish.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/publish.py new file mode 100644 index 00000000000..32196589901 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/model_version/publish.py @@ -0,0 +1,44 @@ +# 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 publish.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", + ) + + client.model_versions.begin_publish( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + version="string", + body={"destinationName": "string", "destinationVersion": "string", "registryName": "string"}, + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ModelVersion/publish.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_deployment/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_deployment/delete.py index 209f1dc99b4..2a0327c1ae0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_deployment/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_deployment/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineDeployment/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineDeployment/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/create_or_update.py index 0ad2062a3ee..3eb3ec68996 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/create_or_update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/create_or_update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -51,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/createOrUpdate.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/delete.py index c00b39bfcf4..be8c55ceb00 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get.py index c22efccb2c1..af90a191ac0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get_token.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get_token.py index f721177eb41..b0b2ba20aa0 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get_token.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/get_token.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/getToken.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/getToken.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list.py index 741567b8cee..2d3f98884b3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list_keys.py index 550945711c4..45ee9db5c85 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/list_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/listKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/regenerate_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/regenerate_keys.py index f6f874cb710..268def3e9ea 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/regenerate_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/regenerate_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/regenerateKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/regenerateKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/update.py index b1c25f72b06..f7c092a49fc 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/online_endpoint/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/OnlineEndpoint/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/OnlineEndpoint/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/operations_list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/operations_list.py index 91510c53d5b..3a63348bd28 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/operations_list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/operationsList.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/operationsList.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/resync_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/resync_keys.py index f332a412092..47ba04a5253 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/resync_keys.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/resync_keys.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/resyncKeys.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/resyncKeys.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/create_or_update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/create_or_update.py new file mode 100644 index 00000000000..ae8d1d3e171 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/create_or_update.py @@ -0,0 +1,55 @@ +# 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.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.serverless_endpoints.begin_create_or_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={ + "identity": {"type": "SystemAssigned", "userAssignedIdentities": {"string": {}}}, + "kind": "string", + "location": "string", + "properties": { + "authMode": "Key", + "contentSafety": {"contentSafetyStatus": "Enabled"}, + "modelSettings": {"modelId": "string"}, + }, + "sku": {"capacity": 1, "family": "string", "name": "string", "size": "string", "tier": "Standard"}, + "tags": {}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/delete.py new file mode 100644 index 00000000000..6eb78d40a94 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/delete.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 delete.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", + ) + + client.serverless_endpoints.begin_delete( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get.py new file mode 100644 index 00000000000..b64d0934637 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/get.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 get.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.serverless_endpoints.get( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list.py new file mode 100644 index 00000000000..653e30122e1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list.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 list.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.serverless_endpoints.list( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list_keys.py new file mode 100644 index 00000000000..bb04ee09f95 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/list_keys.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 list_keys.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.serverless_endpoints.list_keys( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/listKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/regenerate_keys.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/regenerate_keys.py new file mode 100644 index 00000000000..fd665d5b5cf --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/regenerate_keys.py @@ -0,0 +1,44 @@ +# 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 regenerate_keys.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.serverless_endpoints.begin_regenerate_keys( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={"keyType": "Primary", "keyValue": "string"}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/regenerateKeys.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/update.py new file mode 100644 index 00000000000..d9d0a004662 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/serverless_endpoint/update.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.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.serverless_endpoints.begin_update( + resource_group_name="test-rg", + workspace_name="my-aml-workspace", + name="string", + body={ + "identity": {"type": "None", "userAssignedIdentities": {"string": {}}}, + "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/2024-10-01-preview/examples/Workspace/ServerlessEndpoint/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py index f8b3fae5c4c..00833250b38 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace/update.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -32,7 +33,7 @@ def main(): response = client.workspaces.begin_update( resource_group_name="workspace-1234", workspace_name="testworkspace", - parameters={ + body={ "properties": { "description": "new description", "friendlyName": "New friendly name", @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/Workspace/update.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/Workspace/update.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create.py index 110d4862cc3..98306ecfa50 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -33,11 +34,10 @@ def main(): resource_group_name="resourceGroup-1", workspace_name="workspace-1", connection_name="connection-1", - parameters={"properties": {"authType": "None", "category": "ContainerRegistry", "target": "www.facebook.com"}}, ) print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/WorkspaceConnection/create.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/create.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create_deployment.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create_deployment.py new file mode 100644 index 00000000000..95ed6b2a252 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/create_deployment.py @@ -0,0 +1,51 @@ +# 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_deployment.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.connection.begin_create_or_update_deployment( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + connection_name="testConnection", + deployment_name="text-davinci-003", + body={ + "properties": { + "model": {"format": "OpenAI", "name": "text-davinci-003", "version": "1"}, + "type": "Azure.OpenAI", + "versionUpgradeOption": "OnceNewDefaultVersionAvailable", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/createDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete.py index c154fbe498b..86fd2503195 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -36,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/WorkspaceConnection/delete.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/delete.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete_deployment.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete_deployment.py new file mode 100644 index 00000000000..8442b080549 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/delete_deployment.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 delete_deployment.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", + ) + + client.connection.begin_delete_deployment( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + deployment_name="testDeploymentName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/deleteDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get.py index 98aa005623e..71d49182eb5 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/WorkspaceConnection/get.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/get.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_deployment.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_deployment.py new file mode 100644 index 00000000000..d298beb1ece --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_deployment.py @@ -0,0 +1,44 @@ +# 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_deployment.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.connection.get_deployment( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + connection_name="testConnection", + deployment_name="text-davinci-003", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/getDeployment.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_models.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_models.py new file mode 100644 index 00000000000..727411e04f8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/get_models.py @@ -0,0 +1,44 @@ +# 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_models.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.connection.get_models( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/getModels.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list.py index 3f4299cf180..6e53c082ab3 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/WorkspaceConnection/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_connection_models.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_connection_models.py new file mode 100644 index 00000000000..8cfeda371c8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_connection_models.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 list_connection_models.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.connection.get_all_models( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/listConnectionModels.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_deployments.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_deployments.py new file mode 100644 index 00000000000..3bec63ae72e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_deployments.py @@ -0,0 +1,44 @@ +# 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_deployments.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.connection.list_deployments( + resource_group_name="resourceGroup-1", + workspace_name="testworkspace", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/listDeployments.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_secrets.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_secrets.py new file mode 100644 index 00000000000..a09601d5312 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/list_secrets.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 list_secrets.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.workspace_connections.list_secrets( + resource_group_name="test-rg", + workspace_name="workspace-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/listSecrets.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/create.py new file mode 100644 index 00000000000..519541e10b2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/create.py @@ -0,0 +1,45 @@ +# 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.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.connection_rai_blocklist.begin_create( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + body={"properties": {"description": "Basic blocklist description"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklist/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/delete.py new file mode 100644 index 00000000000..924f5819ece --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/delete.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 delete.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", + ) + + client.connection_rai_blocklist.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklist/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/get.py new file mode 100644 index 00000000000..3474ee67a10 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/get.py @@ -0,0 +1,44 @@ +# 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.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.connection_rai_blocklist.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklist/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/list.py new file mode 100644 index 00000000000..e089ef33caa --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist/list.py @@ -0,0 +1,44 @@ +# 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.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.connection_rai_blocklists.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklist/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/add_bulk.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/add_bulk.py new file mode 100644 index 00000000000..61cdb99b0dd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/add_bulk.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 add_bulk.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.connection_rai_blocklist_item.begin_add_bulk( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + body=[ + {"name": "myblocklistitem1", "properties": {"isRegex": True, "pattern": "^[a-z0-9_-]{2,16}$"}}, + {"name": "myblocklistitem2", "properties": {"isRegex": False, "pattern": "blockwords"}}, + ], + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/addBulk.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/create.py new file mode 100644 index 00000000000..bf41ad069c3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/create.py @@ -0,0 +1,46 @@ +# 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.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.connection_rai_blocklist_item.begin_create( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + body={"properties": {"isRegex": False, "pattern": "Pattern To Block"}}, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete.py new file mode 100644 index 00000000000..7e6fb00bd3d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete.py @@ -0,0 +1,44 @@ +# 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 delete.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", + ) + + client.connection_rai_blocklist_item.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete_bulk.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete_bulk.py new file mode 100644 index 00000000000..8450f192c9b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/delete_bulk.py @@ -0,0 +1,44 @@ +# 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 delete_bulk.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", + ) + + client.connection_rai_blocklist_item.begin_delete_bulk( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + body=["myblocklistitem1", "myblocklistitem2"], + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/deleteBulk.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/get.py new file mode 100644 index 00000000000..2b32b3b2534 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/get.py @@ -0,0 +1,45 @@ +# 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.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.connection_rai_blocklist_item.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + rai_blocklist_item_name="raiBlocklistItemName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/list.py new file mode 100644 index 00000000000..0a1662a8ad9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_blocklist_item/list.py @@ -0,0 +1,45 @@ +# 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.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.connection_rai_blocklist_items.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_blocklist_name="raiBlocklistName", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiBlocklistItem/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/create.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/create.py new file mode 100644 index 00000000000..a8905f54c7d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/create.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.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.connection_rai_policy.begin_create( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_policy_name="raiPolicyName", + body={ + "properties": { + "basePolicyName": "112", + "completionBlocklists": [{"blocking": False, "blocklistName": "blocklistName"}], + "contentFilters": [ + { + "allowedContentLevel": "Low", + "blocking": False, + "enabled": False, + "name": "policyName", + "source": "Prompt", + } + ], + "mode": "Blocking", + "promptBlocklists": [{"blocking": False, "blocklistName": "blocklistName"}], + "type": "SystemManaged", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiPolicy/create.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/delete.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/delete.py new file mode 100644 index 00000000000..f03b4530f35 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/delete.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 delete.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", + ) + + client.connection_rai_policy.begin_delete( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_policy_name="raiPolicyName", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiPolicy/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/get.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/get.py new file mode 100644 index 00000000000..b37f9e62a32 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/get.py @@ -0,0 +1,44 @@ +# 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.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.connection_rai_policy.get( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + rai_policy_name="raiPolicyName", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiPolicy/get.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/list.py new file mode 100644 index 00000000000..df7c0b9f3f4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/rai_policy/list.py @@ -0,0 +1,44 @@ +# 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.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.connection_rai_policies.list( + resource_group_name="test-rg", + workspace_name="aml-workspace-name", + connection_name="testConnection", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/RaiPolicy/list.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/test_connection.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/test_connection.py new file mode 100644 index 00000000000..cf00d621ca7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/test_connection.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 test_connection.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", + ) + + client.workspace_connections.begin_test_connection( + resource_group_name="resourceGroup-1", + workspace_name="workspace-1", + connection_name="connection-1", + ).result() + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/testConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/update.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/update.py new file mode 100644 index 00000000000..66715aaf269 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_connection/update.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.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.workspace_connections.update( + resource_group_name="test-rg", + workspace_name="workspace-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceConnection/update.json +if __name__ == "__main__": + main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_feature/list.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_feature/list.py index 3f1b7fa8da6..39f56b8ad8b 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_feature/list.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_samples/workspace_feature/list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/stable/2023-04-01/examples/WorkspaceFeature/list.json +# x-ms-original-file: specification/machinelearningservices/resource-manager/Microsoft.MachineLearningServices/preview/2024-10-01-preview/examples/WorkspaceFeature/list.json if __name__ == "__main__": main() diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/conftest.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/conftest.py new file mode 100644 index 00000000000..b17bccaf9d5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/conftest.py @@ -0,0 +1,47 @@ +# 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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + machinelearningservicesmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + machinelearningservicesmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + machinelearningservicesmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + machinelearningservicesmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=machinelearningservicesmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=machinelearningservicesmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=machinelearningservicesmgmt_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=machinelearningservicesmgmt_client_secret, value="00000000-0000-0000-0000-000000000000" + ) + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations.py new file mode 100644 index 00000000000..b465d9b0c0f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations.py @@ -0,0 +1,131 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtBatchDeploymentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.batch_deployments.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.batch_deployments.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.batch_deployments.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.batch_deployments.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={"properties": {"description": "str"}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.batch_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "location": "str", + "properties": { + "codeConfiguration": {"scoringScript": "str", "codeId": "str"}, + "compute": "str", + "deploymentConfiguration": "batch_deployment_configuration", + "description": "str", + "environmentId": "str", + "environmentVariables": {"str": "str"}, + "errorThreshold": -1, + "loggingLevel": "str", + "maxConcurrencyPerInstance": 1, + "miniBatchSize": 10, + "model": "asset_reference_base", + "outputAction": "str", + "outputFileName": "predictions.csv", + "properties": {"str": "str"}, + "provisioningState": "str", + "resources": {"instanceCount": 1, "instanceType": "str", "properties": {"str": {}}}, + "retrySettings": {"maxRetries": 3, "timeout": "PT30S"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations_async.py new file mode 100644 index 00000000000..a5eae2616e5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_deployments_operations_async.py @@ -0,0 +1,138 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtBatchDeploymentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.batch_deployments.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.batch_deployments.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.batch_deployments.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.batch_deployments.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={"properties": {"description": "str"}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.batch_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "location": "str", + "properties": { + "codeConfiguration": {"scoringScript": "str", "codeId": "str"}, + "compute": "str", + "deploymentConfiguration": "batch_deployment_configuration", + "description": "str", + "environmentId": "str", + "environmentVariables": {"str": "str"}, + "errorThreshold": -1, + "loggingLevel": "str", + "maxConcurrencyPerInstance": 1, + "miniBatchSize": 10, + "model": "asset_reference_base", + "outputAction": "str", + "outputFileName": "predictions.csv", + "properties": {"str": "str"}, + "provisioningState": "str", + "resources": {"instanceCount": 1, "instanceType": "str", "properties": {"str": {}}}, + "retrySettings": {"maxRetries": 3, "timeout": "PT30S"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations.py new file mode 100644 index 00000000000..0c08726bc3b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations.py @@ -0,0 +1,130 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtBatchEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.batch_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.batch_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.batch_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.batch_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.batch_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "defaults": {"deploymentName": "str"}, + "description": "str", + "keys": {"primaryKey": "str", "secondaryKey": "str"}, + "properties": {"str": "str"}, + "provisioningState": "str", + "scoringUri": "str", + "swaggerUri": "str", + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.batch_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations_async.py new file mode 100644 index 00000000000..baad99ca89e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_batch_endpoints_operations_async.py @@ -0,0 +1,137 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtBatchEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.batch_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.batch_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.batch_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.batch_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.batch_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "defaults": {"deploymentName": "str"}, + "description": "str", + "keys": {"primaryKey": "str", "secondaryKey": "str"}, + "properties": {"str": "str"}, + "provisioningState": "str", + "scoringUri": "str", + "swaggerUri": "str", + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.batch_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations.py new file mode 100644 index 00000000000..005bdc1880b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations.py @@ -0,0 +1,82 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCapabilityHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.capability_hosts.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.capability_hosts.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations_async.py new file mode 100644 index 00000000000..ebb5ed7c83e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_capability_hosts_operations_async.py @@ -0,0 +1,87 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCapabilityHostsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.capability_hosts.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.capability_hosts.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations.py new file mode 100644 index 00000000000..89e408144a5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCodeContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.code_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.code_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.code_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.code_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations_async.py new file mode 100644 index 00000000000..20360a62704 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_containers_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCodeContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.code_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.code_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.code_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.code_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations.py new file mode 100644 index 00000000000..94752abb579 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations.py @@ -0,0 +1,126 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCodeVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.code_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.code_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.code_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.code_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "codeUri": "str", + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_publish(self, resource_group): + response = self.client.code_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_get_start_pending_upload(self, resource_group): + response = self.client.code_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations_async.py new file mode 100644 index 00000000000..532e2aa636f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_code_versions_operations_async.py @@ -0,0 +1,129 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtCodeVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.code_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.code_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.code_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.code_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "codeUri": "str", + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_publish(self, resource_group): + response = await ( + await self.client.code_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_get_start_pending_upload(self, resource_group): + response = await self.client.code_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations.py new file mode 100644 index 00000000000..01b86435441 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComponentContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.component_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.component_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.component_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.component_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations_async.py new file mode 100644 index 00000000000..f770f64d5f0 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_containers_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComponentContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.component_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.component_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.component_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.component_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations.py new file mode 100644 index 00000000000..87961b8a3df --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComponentVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.component_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.component_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.component_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.component_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "componentSpec": {}, + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_publish(self, resource_group): + response = self.client.component_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations_async.py new file mode 100644 index 00000000000..9f4be28f88d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_component_versions_operations_async.py @@ -0,0 +1,114 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComponentVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.component_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.component_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.component_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.component_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "componentSpec": {}, + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_publish(self, resource_group): + response = await ( + await self.client.component_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations.py new file mode 100644 index 00000000000..40e463e802a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations.py @@ -0,0 +1,284 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComputeOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.compute.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.compute.get( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.compute.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={ + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": "compute", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.compute.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={ + "properties": { + "scaleSettings": { + "maxNodeCount": 0, + "minNodeCount": 0, + "nodeIdleTimeBeforeScaleDown": "1 day, 0:00:00", + } + } + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.compute.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + underlying_resource_action="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_custom_services(self, resource_group): + response = self.client.compute.update_custom_services( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + custom_services=[ + { + "docker": {"privileged": bool}, + "endpoints": [{"hostIp": "str", "name": "str", "protocol": "tcp", "published": 0, "target": 0}], + "environmentVariables": {"str": {"type": "local", "value": "str"}}, + "image": {"reference": "str", "type": "docker", "version": "str"}, + "kernel": {"argv": ["str"], "displayName": "str", "language": "str"}, + "name": "str", + "volumes": [ + { + "bind": {"createHostPath": bool, "propagation": "str", "selinux": "str"}, + "consistency": "str", + "readOnly": bool, + "source": "str", + "target": "str", + "tmpfs": {"size": 0}, + "type": "bind", + "volume": {"nocopy": bool}, + } + ], + } + ], + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_nodes(self, resource_group): + response = self.client.compute.list_nodes( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.compute.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_data_mounts(self, resource_group): + response = self.client.compute.update_data_mounts( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + data_mounts=[ + { + "createdBy": "str", + "error": "str", + "mountAction": "str", + "mountMode": "str", + "mountName": "str", + "mountPath": "str", + "mountState": "str", + "mountedOn": "2020-02-20 00:00:00", + "source": "str", + "sourceType": "str", + } + ], + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.compute.begin_start( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.compute.begin_stop( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart(self, resource_group): + response = self.client.compute.begin_restart( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update_idle_shutdown_setting(self, resource_group): + response = self.client.compute.update_idle_shutdown_setting( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={"idleTimeBeforeShutdown": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_allowed_resize_sizes(self, resource_group): + response = self.client.compute.get_allowed_resize_sizes( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resize(self, resource_group): + response = self.client.compute.begin_resize( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={"targetVMSize": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations_async.py new file mode 100644 index 00000000000..cd67e0b5c98 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_compute_operations_async.py @@ -0,0 +1,299 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtComputeOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.compute.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.compute.get( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.compute.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={ + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": "compute", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.compute.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={ + "properties": { + "scaleSettings": { + "maxNodeCount": 0, + "minNodeCount": 0, + "nodeIdleTimeBeforeScaleDown": "1 day, 0:00:00", + } + } + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.compute.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + underlying_resource_action="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_custom_services(self, resource_group): + response = await self.client.compute.update_custom_services( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + custom_services=[ + { + "docker": {"privileged": bool}, + "endpoints": [{"hostIp": "str", "name": "str", "protocol": "tcp", "published": 0, "target": 0}], + "environmentVariables": {"str": {"type": "local", "value": "str"}}, + "image": {"reference": "str", "type": "docker", "version": "str"}, + "kernel": {"argv": ["str"], "displayName": "str", "language": "str"}, + "name": "str", + "volumes": [ + { + "bind": {"createHostPath": bool, "propagation": "str", "selinux": "str"}, + "consistency": "str", + "readOnly": bool, + "source": "str", + "target": "str", + "tmpfs": {"size": 0}, + "type": "bind", + "volume": {"nocopy": bool}, + } + ], + } + ], + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_nodes(self, resource_group): + response = self.client.compute.list_nodes( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.compute.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_data_mounts(self, resource_group): + response = await self.client.compute.update_data_mounts( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + data_mounts=[ + { + "createdBy": "str", + "error": "str", + "mountAction": "str", + "mountMode": "str", + "mountName": "str", + "mountPath": "str", + "mountState": "str", + "mountedOn": "2020-02-20 00:00:00", + "source": "str", + "sourceType": "str", + } + ], + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.compute.begin_start( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.compute.begin_stop( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart(self, resource_group): + response = await ( + await self.client.compute.begin_restart( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update_idle_shutdown_setting(self, resource_group): + response = await self.client.compute.update_idle_shutdown_setting( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={"idleTimeBeforeShutdown": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_allowed_resize_sizes(self, resource_group): + response = await self.client.compute.get_allowed_resize_sizes( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resize(self, resource_group): + response = await ( + await self.client.compute.begin_resize( + resource_group_name=resource_group.name, + workspace_name="str", + compute_name="str", + parameters={"targetVMSize": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations.py new file mode 100644 index 00000000000..f365783ae1c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations.py @@ -0,0 +1,113 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_deployments(self, resource_group): + response = self.client.connection.list_deployments( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_deployment(self, resource_group): + response = self.client.connection.begin_delete_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_deployment(self, resource_group): + response = self.client.connection.get_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update_deployment(self, resource_group): + response = self.client.connection.begin_create_or_update_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + body={ + "properties": "endpoint_deployment_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_models(self, resource_group): + response = self.client.connection.get_models( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_all_models(self, resource_group): + response = self.client.connection.get_all_models( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations_async.py new file mode 100644 index 00000000000..db7fbc3f663 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_operations_async.py @@ -0,0 +1,118 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_deployments(self, resource_group): + response = self.client.connection.list_deployments( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_deployment(self, resource_group): + response = await ( + await self.client.connection.begin_delete_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_deployment(self, resource_group): + response = await self.client.connection.get_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update_deployment(self, resource_group): + response = await ( + await self.client.connection.begin_create_or_update_deployment( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + deployment_name="str", + body={ + "properties": "endpoint_deployment_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_models(self, resource_group): + response = self.client.connection.get_models( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_all_models(self, resource_group): + response = await self.client.connection.get_all_models( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations.py new file mode 100644 index 00000000000..f87f40fc24c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations.py @@ -0,0 +1,108 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistItemOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_add_bulk(self, resource_group): + response = self.client.connection_rai_blocklist_item.begin_add_bulk( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_bulk(self, resource_group): + response = self.client.connection_rai_blocklist_item.begin_delete_bulk( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body={}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.connection_rai_blocklist_item.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connection_rai_blocklist_item.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.connection_rai_blocklist_item.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + body={ + "properties": {"isRegex": bool, "pattern": "str"}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations_async.py new file mode 100644 index 00000000000..ea1656cad32 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_item_operations_async.py @@ -0,0 +1,117 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistItemOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_add_bulk(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist_item.begin_add_bulk( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_bulk(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist_item.begin_delete_bulk( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body={}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist_item.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connection_rai_blocklist_item.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist_item.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + rai_blocklist_item_name="str", + body={ + "properties": {"isRegex": bool, "pattern": "str"}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations.py new file mode 100644 index 00000000000..e92c9a9b107 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations.py @@ -0,0 +1,33 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistItemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connection_rai_blocklist_items.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations_async.py new file mode 100644 index 00000000000..c8b058d5424 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_items_operations_async.py @@ -0,0 +1,34 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistItemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connection_rai_blocklist_items.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations.py new file mode 100644 index 00000000000..68528e73afe --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations.py @@ -0,0 +1,75 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.connection_rai_blocklist.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connection_rai_blocklist.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.connection_rai_blocklist.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body={ + "properties": {"description": "str"}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations_async.py new file mode 100644 index 00000000000..daf4e6edf7f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklist_operations_async.py @@ -0,0 +1,80 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connection_rai_blocklist.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.connection_rai_blocklist.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_blocklist_name="str", + body={ + "properties": {"description": "str"}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations.py new file mode 100644 index 00000000000..6cc41043e1d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connection_rai_blocklists.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations_async.py new file mode 100644 index 00000000000..e1019f605eb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_blocklists_operations_async.py @@ -0,0 +1,33 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiBlocklistsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connection_rai_blocklists.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations.py new file mode 100644 index 00000000000..05c1d3cf6d3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.connection_rai_policies.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations_async.py new file mode 100644 index 00000000000..2f151fa27b8 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policies_operations_async.py @@ -0,0 +1,33 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.connection_rai_policies.list( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations.py new file mode 100644 index 00000000000..042dc62993a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations.py @@ -0,0 +1,90 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiPolicyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.connection_rai_policy.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.connection_rai_policy.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.connection_rai_policy.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + body={ + "properties": { + "basePolicyName": "str", + "completionBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "contentFilters": [ + { + "allowedContentLevel": "str", + "blocking": bool, + "enabled": bool, + "name": "str", + "source": "str", + } + ], + "mode": "str", + "promptBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "type": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations_async.py new file mode 100644 index 00000000000..b7939ff2824 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_connection_rai_policy_operations_async.py @@ -0,0 +1,95 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtConnectionRaiPolicyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.connection_rai_policy.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.connection_rai_policy.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.connection_rai_policy.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + rai_policy_name="str", + body={ + "properties": { + "basePolicyName": "str", + "completionBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "contentFilters": [ + { + "allowedContentLevel": "str", + "blocking": bool, + "enabled": bool, + "name": "str", + "source": "str", + } + ], + "mode": "str", + "promptBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "type": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations.py new file mode 100644 index 00000000000..e87b01fb44d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDataContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.data_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.data_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.data_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.data_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "dataType": "str", + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations_async.py new file mode 100644 index 00000000000..909e8922f3f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_containers_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDataContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.data_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.data_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.data_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.data_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "dataType": "str", + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations.py new file mode 100644 index 00000000000..9db4ca9eb39 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations.py @@ -0,0 +1,103 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDataVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.data_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.data_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.data_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.data_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": "data_version_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_publish(self, resource_group): + response = self.client.data_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations_async.py new file mode 100644 index 00000000000..c50443d8dbd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_data_versions_operations_async.py @@ -0,0 +1,106 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDataVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.data_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.data_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.data_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.data_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": "data_version_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_publish(self, resource_group): + response = await ( + await self.client.data_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations.py new file mode 100644 index 00000000000..e8719589311 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDatastoresOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.datastores.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.datastores.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.datastores.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.datastores.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": "datastore_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.datastores.list_secrets( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations_async.py new file mode 100644 index 00000000000..d58eb3c930a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_datastores_operations_async.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtDatastoresOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.datastores.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.datastores.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.datastores.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.datastores.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": "datastore_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.datastores.list_secrets( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations.py new file mode 100644 index 00000000000..38bba282b6e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations.py @@ -0,0 +1,100 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEndpointDeploymentOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_in_workspace(self, resource_group): + response = self.client.endpoint_deployment.get_in_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.endpoint_deployment.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.endpoint_deployment.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.endpoint_deployment.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.endpoint_deployment.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "properties": "endpoint_deployment_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations_async.py new file mode 100644 index 00000000000..c85bfd338c6 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_deployment_operations_async.py @@ -0,0 +1,105 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEndpointDeploymentOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_in_workspace(self, resource_group): + response = self.client.endpoint_deployment.get_in_workspace( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.endpoint_deployment.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.endpoint_deployment.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.endpoint_deployment.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.endpoint_deployment.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "properties": "endpoint_deployment_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations.py new file mode 100644 index 00000000000..7b73581abbb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEndpointOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.endpoint.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.endpoint.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.endpoint.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "properties": "endpoint_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.endpoint.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_models(self, resource_group): + response = self.client.endpoint.get_models( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_regenerate_keys(self, resource_group): + response = self.client.endpoint.regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"keyName": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations_async.py new file mode 100644 index 00000000000..45b4bbfd251 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_endpoint_operations_async.py @@ -0,0 +1,114 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEndpointOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.endpoint.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.endpoint.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.endpoint.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "properties": "endpoint_resource_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.endpoint.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_models(self, resource_group): + response = self.client.endpoint.get_models( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_regenerate_keys(self, resource_group): + response = await self.client.endpoint.regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"keyName": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations.py new file mode 100644 index 00000000000..36aee0f2228 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEnvironmentContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.environment_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.environment_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.environment_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.environment_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations_async.py new file mode 100644 index 00000000000..74cdbcab790 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_containers_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEnvironmentContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.environment_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.environment_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.environment_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.environment_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations.py new file mode 100644 index 00000000000..a4e4b50a9ef --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations.py @@ -0,0 +1,122 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEnvironmentVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.environment_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.environment_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.environment_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.environment_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "autoRebuild": "str", + "build": {"contextUri": "str", "dockerfilePath": "Dockerfile"}, + "condaFile": "str", + "description": "str", + "environmentType": "str", + "image": "str", + "inferenceConfig": { + "livenessRoute": {"path": "str", "port": 0}, + "readinessRoute": {"path": "str", "port": 0}, + "scoringRoute": {"path": "str", "port": 0}, + }, + "isAnonymous": False, + "isArchived": False, + "osType": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_publish(self, resource_group): + response = self.client.environment_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations_async.py new file mode 100644 index 00000000000..bec043d477d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_environment_versions_operations_async.py @@ -0,0 +1,125 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtEnvironmentVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.environment_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.environment_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.environment_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.environment_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "autoRebuild": "str", + "build": {"contextUri": "str", "dockerfilePath": "Dockerfile"}, + "condaFile": "str", + "description": "str", + "environmentType": "str", + "image": "str", + "inferenceConfig": { + "livenessRoute": {"path": "str", "port": 0}, + "readinessRoute": {"path": "str", "port": 0}, + "scoringRoute": {"path": "str", "port": 0}, + }, + "isAnonymous": False, + "isArchived": False, + "osType": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_publish(self, resource_group): + response = await ( + await self.client.environment_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations.py new file mode 100644 index 00000000000..d57454bfbe2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.features.list( + resource_group_name=resource_group.name, + workspace_name="str", + featureset_name="str", + featureset_version="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.features.get( + resource_group_name=resource_group.name, + workspace_name="str", + featureset_name="str", + featureset_version="str", + feature_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations_async.py new file mode 100644 index 00000000000..0114bc14891 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_features_operations_async.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.features.list( + resource_group_name=resource_group.name, + workspace_name="str", + featureset_name="str", + featureset_version="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.features.get( + resource_group_name=resource_group.name, + workspace_name="str", + featureset_name="str", + featureset_version="str", + feature_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations.py new file mode 100644 index 00000000000..d3f15904806 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesetContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.featureset_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.featureset_containers.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_entity(self, resource_group): + response = self.client.featureset_containers.get_entity( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.featureset_containers.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations_async.py new file mode 100644 index 00000000000..726ccbb5a9c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesetContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.featureset_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.featureset_containers.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_entity(self, resource_group): + response = await self.client.featureset_containers.get_entity( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.featureset_containers.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations.py new file mode 100644 index 00000000000..dc70dac516f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations.py @@ -0,0 +1,141 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesetVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.featureset_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.featureset_versions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.featureset_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.featureset_versions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "entities": ["str"], + "isAnonymous": False, + "isArchived": False, + "materializationSettings": { + "notification": {"emailOn": ["str"], "emails": ["str"], "webhooks": {"str": "webhook"}}, + "resource": {"instanceType": "str"}, + "schedule": { + "frequency": "str", + "interval": 0, + "triggerType": "Recurrence", + "endTime": "str", + "schedule": {"hours": [0], "minutes": [0], "monthDays": [0], "weekDays": ["str"]}, + "startTime": "str", + "timeZone": "UTC", + }, + "sparkConfiguration": {"str": "str"}, + "storeType": "str", + }, + "properties": {"str": "str"}, + "provisioningState": "str", + "specification": {"path": "str"}, + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_backfill(self, resource_group): + response = self.client.featureset_versions.begin_backfill( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "dataAvailabilityStatus": ["str"], + "description": "str", + "displayName": "str", + "featureWindow": { + "featureWindowEnd": "2020-02-20 00:00:00", + "featureWindowStart": "2020-02-20 00:00:00", + }, + "jobId": "str", + "properties": {"str": "str"}, + "resource": {"instanceType": "str"}, + "sparkConfiguration": {"str": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations_async.py new file mode 100644 index 00000000000..1bedc8a3d88 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featureset_versions_operations_async.py @@ -0,0 +1,148 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturesetVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.featureset_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.featureset_versions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.featureset_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.featureset_versions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "entities": ["str"], + "isAnonymous": False, + "isArchived": False, + "materializationSettings": { + "notification": {"emailOn": ["str"], "emails": ["str"], "webhooks": {"str": "webhook"}}, + "resource": {"instanceType": "str"}, + "schedule": { + "frequency": "str", + "interval": 0, + "triggerType": "Recurrence", + "endTime": "str", + "schedule": {"hours": [0], "minutes": [0], "monthDays": [0], "weekDays": ["str"]}, + "startTime": "str", + "timeZone": "UTC", + }, + "sparkConfiguration": {"str": "str"}, + "storeType": "str", + }, + "properties": {"str": "str"}, + "provisioningState": "str", + "specification": {"path": "str"}, + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_backfill(self, resource_group): + response = await ( + await self.client.featureset_versions.begin_backfill( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "dataAvailabilityStatus": ["str"], + "description": "str", + "displayName": "str", + "featureWindow": { + "featureWindowEnd": "2020-02-20 00:00:00", + "featureWindowStart": "2020-02-20 00:00:00", + }, + "jobId": "str", + "properties": {"str": "str"}, + "resource": {"instanceType": "str"}, + "sparkConfiguration": {"str": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations.py new file mode 100644 index 00000000000..ee220fdc277 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturestoreEntityContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.featurestore_entity_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.featurestore_entity_containers.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_entity(self, resource_group): + response = self.client.featurestore_entity_containers.get_entity( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.featurestore_entity_containers.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations_async.py new file mode 100644 index 00000000000..24aee8b6ad5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturestoreEntityContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.featurestore_entity_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.featurestore_entity_containers.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_entity(self, resource_group): + response = await self.client.featurestore_entity_containers.get_entity( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.featurestore_entity_containers.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations.py new file mode 100644 index 00000000000..c32837de16d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturestoreEntityVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.featurestore_entity_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.featurestore_entity_versions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.featurestore_entity_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.featurestore_entity_versions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "indexColumns": [{"columnName": "str", "dataType": "str"}], + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations_async.py new file mode 100644 index 00000000000..93e90732fa4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_featurestore_entity_versions_operations_async.py @@ -0,0 +1,102 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtFeaturestoreEntityVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.featurestore_entity_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.featurestore_entity_versions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.featurestore_entity_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.featurestore_entity_versions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "indexColumns": [{"columnName": "str", "dataType": "str"}], + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations.py new file mode 100644 index 00000000000..81306262126 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations.py @@ -0,0 +1,121 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferenceEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.inference_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.inference_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.inference_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.inference_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + body={}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.inference_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "groupName": "str", + "description": "str", + "endpointUri": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "requestConfiguration": {"maxConcurrentRequestsPerInstance": 1, "requestTimeout": "PT5S"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations_async.py new file mode 100644 index 00000000000..decf3405980 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_endpoints_operations_async.py @@ -0,0 +1,128 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferenceEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.inference_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.inference_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.inference_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.inference_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + body={}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.inference_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "groupName": "str", + "description": "str", + "endpointUri": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "requestConfiguration": {"maxConcurrentRequestsPerInstance": 1, "requestTimeout": "PT5S"}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations.py new file mode 100644 index 00000000000..d918f95828b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations.py @@ -0,0 +1,221 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferenceGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.inference_groups.list( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.inference_groups.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.inference_groups.get( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.inference_groups.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={ + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.inference_groups.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={ + "location": "str", + "properties": { + "description": "str", + "environmentConfiguration": { + "environmentId": "str", + "environmentVariables": [{"key": "str", "value": "str"}], + "livenessProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + "readinessProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + "startupProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + }, + "modelConfiguration": {"modelId": "str"}, + "nodeSkuType": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scaleUnitSize": 0, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_delta_models_status_async(self, resource_group): + response = self.client.inference_groups.get_delta_models_status_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"deltaModels": ["str"], "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_delta_models_async(self, resource_group): + response = self.client.inference_groups.list_delta_models_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"count": -1, "skipToken": "str", "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_modify_delta_models_async(self, resource_group): + response = self.client.inference_groups.begin_modify_delta_models_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"addDeltaModels": ["str"], "removeDeltaModels": ["str"], "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_status(self, resource_group): + response = self.client.inference_groups.get_status( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_skus(self, resource_group): + response = self.client.inference_groups.list_skus( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations_async.py new file mode 100644 index 00000000000..463e605397c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_groups_operations_async.py @@ -0,0 +1,230 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferenceGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.inference_groups.list( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.inference_groups.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.inference_groups.get( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.inference_groups.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={ + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.inference_groups.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={ + "location": "str", + "properties": { + "description": "str", + "environmentConfiguration": { + "environmentId": "str", + "environmentVariables": [{"key": "str", "value": "str"}], + "livenessProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + "readinessProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + "startupProbe": { + "failureThreshold": 30, + "initialDelay": "1 day, 0:00:00", + "period": "PT10S", + "successThreshold": 1, + "timeout": "PT2S", + }, + }, + "modelConfiguration": {"modelId": "str"}, + "nodeSkuType": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scaleUnitSize": 0, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_delta_models_status_async(self, resource_group): + response = await self.client.inference_groups.get_delta_models_status_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"deltaModels": ["str"], "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_delta_models_async(self, resource_group): + response = self.client.inference_groups.list_delta_models_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"count": -1, "skipToken": "str", "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_modify_delta_models_async(self, resource_group): + response = await ( + await self.client.inference_groups.begin_modify_delta_models_async( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + body={"addDeltaModels": ["str"], "removeDeltaModels": ["str"], "targetBaseModel": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_status(self, resource_group): + response = await self.client.inference_groups.get_status( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_skus(self, resource_group): + response = self.client.inference_groups.list_skus( + resource_group_name=resource_group.name, + workspace_name="str", + pool_name="str", + group_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations.py new file mode 100644 index 00000000000..f50b6105853 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations.py @@ -0,0 +1,117 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferencePoolsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.inference_pools.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.inference_pools.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.inference_pools.get( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.inference_pools.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + body={ + "identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.inference_pools.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + body={ + "location": "str", + "properties": { + "description": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scaleUnitConfiguration": {"disablePublicEgress": False, "registries": ["str"]}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations_async.py new file mode 100644 index 00000000000..5add6b70a4a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_inference_pools_operations_async.py @@ -0,0 +1,124 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtInferencePoolsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.inference_pools.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.inference_pools.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.inference_pools.get( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.inference_pools.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + body={ + "identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.inference_pools.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + inference_pool_name="str", + body={ + "location": "str", + "properties": { + "description": "str", + "properties": [{"key": "str", "value": "str"}], + "provisioningState": "str", + "scaleUnitConfiguration": {"disablePublicEgress": False, "registries": ["str"]}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations.py new file mode 100644 index 00000000000..a92a9336016 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtJobsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.jobs.get( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.jobs.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + body={ + "properties": "job_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_cancel(self, resource_group): + response = self.client.jobs.begin_cancel( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations_async.py new file mode 100644 index 00000000000..b7fa5db8605 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_jobs_operations_async.py @@ -0,0 +1,102 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtJobsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.jobs.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.jobs.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.jobs.get( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.jobs.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + body={ + "properties": "job_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_cancel(self, resource_group): + response = await ( + await self.client.jobs.begin_cancel( + resource_group_name=resource_group.name, + workspace_name="str", + id="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations.py new file mode 100644 index 00000000000..7f034a087fc --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtManagedNetworkProvisionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_provision_managed_network(self, resource_group): + response = self.client.managed_network_provisions.begin_provision_managed_network( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations_async.py new file mode 100644 index 00000000000..ee676452914 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_provisions_operations_async.py @@ -0,0 +1,34 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtManagedNetworkProvisionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_provision_managed_network(self, resource_group): + response = await ( + await self.client.managed_network_provisions.begin_provision_managed_network( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations.py new file mode 100644 index 00000000000..cb9abbda7ef --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations.py @@ -0,0 +1,84 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtManagedNetworkSettingsRuleOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.managed_network_settings_rule.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.managed_network_settings_rule.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.managed_network_settings_rule.get( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.managed_network_settings_rule.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + body={ + "properties": "outbound_rule", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations_async.py new file mode 100644 index 00000000000..54f9ebbaa8a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_managed_network_settings_rule_operations_async.py @@ -0,0 +1,89 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtManagedNetworkSettingsRuleOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.managed_network_settings_rule.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.managed_network_settings_rule.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.managed_network_settings_rule.get( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.managed_network_settings_rule.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + rule_name="str", + body={ + "properties": "outbound_rule", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations.py new file mode 100644 index 00000000000..99cead3c0b5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations.py @@ -0,0 +1,89 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtMarketplaceSubscriptionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.marketplace_subscriptions.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.marketplace_subscriptions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.marketplace_subscriptions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.marketplace_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "modelId": "str", + "marketplacePlan": {"offerId": "str", "planId": "str", "publisherId": "str"}, + "marketplaceSubscriptionStatus": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations_async.py new file mode 100644 index 00000000000..921f32da6f1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_marketplace_subscriptions_operations_async.py @@ -0,0 +1,94 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtMarketplaceSubscriptionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.marketplace_subscriptions.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.marketplace_subscriptions.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.marketplace_subscriptions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.marketplace_subscriptions.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "modelId": "str", + "marketplacePlan": {"offerId": "str", "planId": "str", "publisherId": "str"}, + "marketplaceSubscriptionStatus": "str", + "provisioningState": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations.py new file mode 100644 index 00000000000..b9be0e11b51 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtModelContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.model_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.model_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.model_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.model_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations_async.py new file mode 100644 index 00000000000..b07f1759bcd --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_containers_operations_async.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtModelContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.model_containers.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.model_containers.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.model_containers.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.model_containers.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations.py new file mode 100644 index 00000000000..e8a2cc03919 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations.py @@ -0,0 +1,115 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtModelVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.model_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.model_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.model_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.model_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "flavors": {"str": {"data": {"str": "str"}}}, + "isAnonymous": False, + "isArchived": False, + "jobName": "str", + "modelType": "str", + "modelUri": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_publish(self, resource_group): + response = self.client.model_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations_async.py new file mode 100644 index 00000000000..c8a1276ea1f --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_model_versions_operations_async.py @@ -0,0 +1,118 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtModelVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.model_versions.list( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.model_versions.delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.model_versions.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.model_versions.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={ + "properties": { + "description": "str", + "flavors": {"str": {"data": {"str": "str"}}}, + "isAnonymous": False, + "isArchived": False, + "jobName": "str", + "modelType": "str", + "modelUri": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_publish(self, resource_group): + response = await ( + await self.client.model_versions.begin_publish( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + version="str", + body={"destinationName": "str", "destinationVersion": "str", "registryName": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations.py new file mode 100644 index 00000000000..2e0c719222b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations.py @@ -0,0 +1,145 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOnlineDeploymentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.online_deployments.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.online_deployments.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.online_deployments.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.online_deployments.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.online_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "location": "str", + "properties": "online_deployment_properties", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_logs(self, resource_group): + response = self.client.online_deployments.get_logs( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={"containerType": "str", "tail": 0}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_skus(self, resource_group): + response = self.client.online_deployments.list_skus( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations_async.py new file mode 100644 index 00000000000..1e586f2d433 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_deployments_operations_async.py @@ -0,0 +1,152 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOnlineDeploymentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.online_deployments.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.online_deployments.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.online_deployments.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.online_deployments.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.online_deployments.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={ + "location": "str", + "properties": "online_deployment_properties", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_logs(self, resource_group): + response = await self.client.online_deployments.get_logs( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + body={"containerType": "str", "tail": 0}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_skus(self, resource_group): + response = self.client.online_deployments.list_skus( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + deployment_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations.py new file mode 100644 index 00000000000..d3aa5480f60 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations.py @@ -0,0 +1,160 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOnlineEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.online_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.online_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.online_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.online_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.online_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "compute": "str", + "description": "str", + "keys": {"primaryKey": "str", "secondaryKey": "str"}, + "mirrorTraffic": {"str": 0}, + "properties": {"str": "str"}, + "provisioningState": "str", + "publicNetworkAccess": "str", + "scoringUri": "str", + "swaggerUri": "str", + "traffic": {"str": 0}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.online_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_regenerate_keys(self, resource_group): + response = self.client.online_endpoints.begin_regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"keyType": "str", "keyValue": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_token(self, resource_group): + response = self.client.online_endpoints.get_token( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations_async.py new file mode 100644 index 00000000000..0ca517c8cd9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_online_endpoints_operations_async.py @@ -0,0 +1,169 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOnlineEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.online_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.online_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.online_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.online_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, "tags": {"str": "str"}}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.online_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "compute": "str", + "description": "str", + "keys": {"primaryKey": "str", "secondaryKey": "str"}, + "mirrorTraffic": {"str": 0}, + "properties": {"str": "str"}, + "provisioningState": "str", + "publicNetworkAccess": "str", + "scoringUri": "str", + "swaggerUri": "str", + "traffic": {"str": 0}, + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.online_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_regenerate_keys(self, resource_group): + response = await ( + await self.client.online_endpoints.begin_regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + body={"keyType": "str", "keyValue": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_token(self, resource_group): + response = await self.client.online_endpoints.get_token( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations.py new file mode 100644 index 00000000000..362678887d1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations.py @@ -0,0 +1,29 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations_async.py new file mode 100644 index 00000000000..5b7fb4442f9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations.py new file mode 100644 index 00000000000..e06090f2244 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations.py @@ -0,0 +1,95 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.private_endpoint_connections.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + body={ + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations_async.py new file mode 100644 index 00000000000..ae618e39d71 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_endpoint_connections_operations_async.py @@ -0,0 +1,96 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.private_endpoint_connections.delete( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.private_endpoint_connections.create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + private_endpoint_connection_name="str", + body={ + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, + "provisioningState": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations.py new file mode 100644 index 00000000000..7618d750ac9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.private_link_resources.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations_async.py new file mode 100644 index 00000000000..b75a675fe6a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.private_link_resources.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations.py new file mode 100644 index 00000000000..d17af4644f1 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtQuotasOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.quotas.update( + location="str", + parameters={"location": "str", "value": [{"id": "str", "limit": 0, "type": "str", "unit": "str"}]}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.quotas.list( + location="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations_async.py new file mode 100644 index 00000000000..a0d30403033 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_quotas_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtQuotasOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.quotas.update( + location="str", + parameters={"location": "str", "value": [{"id": "str", "limit": 0, "type": "str", "unit": "str"}]}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.quotas.list( + location="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations.py new file mode 100644 index 00000000000..e8410d44fa5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRaiPoliciesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.rai_policies.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations_async.py new file mode 100644 index 00000000000..40f2fd3b05d --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policies_operations_async.py @@ -0,0 +1,33 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRaiPoliciesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.rai_policies.list( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations.py new file mode 100644 index 00000000000..206c17c25a7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations.py @@ -0,0 +1,90 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRaiPolicyOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.rai_policy.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.rai_policy.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.rai_policy.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + body={ + "properties": { + "basePolicyName": "str", + "completionBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "contentFilters": [ + { + "allowedContentLevel": "str", + "blocking": bool, + "enabled": bool, + "name": "str", + "source": "str", + } + ], + "mode": "str", + "promptBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "type": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations_async.py new file mode 100644 index 00000000000..50fd08884b3 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_rai_policy_operations_async.py @@ -0,0 +1,95 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRaiPolicyOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.rai_policy.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.rai_policy.get( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.rai_policy.begin_create( + resource_group_name=resource_group.name, + workspace_name="str", + endpoint_name="str", + rai_policy_name="str", + body={ + "properties": { + "basePolicyName": "str", + "completionBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "contentFilters": [ + { + "allowedContentLevel": "str", + "blocking": bool, + "enabled": bool, + "name": "str", + "source": "str", + } + ], + "mode": "str", + "promptBlocklists": [{"blocking": bool, "blocklistName": "str"}], + "type": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations.py new file mode 100644 index 00000000000..7b68a7c843b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations.py @@ -0,0 +1,250 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistriesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.registries.list_by_subscription( + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registries.list( + resource_group_name=resource_group.name, + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registries.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registries.get( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.registries.update( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registries.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "location": "str", + "discoveryUrl": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "intellectualPropertyPublisher": "str", + "kind": "str", + "managedResourceGroup": {"resourceId": "str"}, + "managedResourceGroupSettings": {"assignedIdentities": [{"principalId": "str"}]}, + "mlFlowRegistryUri": "str", + "name": "str", + "publicNetworkAccess": "str", + "regionDetails": [ + { + "acrDetails": [ + { + "systemCreatedAcrAccount": { + "acrAccountName": "str", + "acrAccountSku": "str", + "armResourceId": {"resourceId": "str"}, + }, + "userCreatedAcrAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + "location": "str", + "storageAccountDetails": [ + { + "systemCreatedStorageAccount": { + "allowBlobPublicAccess": bool, + "armResourceId": {"resourceId": "str"}, + "storageAccountHnsEnabled": bool, + "storageAccountName": "str", + "storageAccountType": "str", + }, + "userCreatedStorageAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + } + ], + "registryPrivateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "location": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "provisioningState": "str", + "registryPrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_remove_regions(self, resource_group): + response = self.client.registries.begin_remove_regions( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "location": "str", + "discoveryUrl": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "intellectualPropertyPublisher": "str", + "kind": "str", + "managedResourceGroup": {"resourceId": "str"}, + "managedResourceGroupSettings": {"assignedIdentities": [{"principalId": "str"}]}, + "mlFlowRegistryUri": "str", + "name": "str", + "publicNetworkAccess": "str", + "regionDetails": [ + { + "acrDetails": [ + { + "systemCreatedAcrAccount": { + "acrAccountName": "str", + "acrAccountSku": "str", + "armResourceId": {"resourceId": "str"}, + }, + "userCreatedAcrAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + "location": "str", + "storageAccountDetails": [ + { + "systemCreatedStorageAccount": { + "allowBlobPublicAccess": bool, + "armResourceId": {"resourceId": "str"}, + "storageAccountHnsEnabled": bool, + "storageAccountName": "str", + "storageAccountType": "str", + }, + "userCreatedStorageAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + } + ], + "registryPrivateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "location": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "provisioningState": "str", + "registryPrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations_async.py new file mode 100644 index 00000000000..437fcca07ba --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registries_operations_async.py @@ -0,0 +1,257 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistriesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.registries.list_by_subscription( + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registries.list( + resource_group_name=resource_group.name, + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registries.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registries.get( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.registries.update( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registries.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "location": "str", + "discoveryUrl": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "intellectualPropertyPublisher": "str", + "kind": "str", + "managedResourceGroup": {"resourceId": "str"}, + "managedResourceGroupSettings": {"assignedIdentities": [{"principalId": "str"}]}, + "mlFlowRegistryUri": "str", + "name": "str", + "publicNetworkAccess": "str", + "regionDetails": [ + { + "acrDetails": [ + { + "systemCreatedAcrAccount": { + "acrAccountName": "str", + "acrAccountSku": "str", + "armResourceId": {"resourceId": "str"}, + }, + "userCreatedAcrAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + "location": "str", + "storageAccountDetails": [ + { + "systemCreatedStorageAccount": { + "allowBlobPublicAccess": bool, + "armResourceId": {"resourceId": "str"}, + "storageAccountHnsEnabled": bool, + "storageAccountName": "str", + "storageAccountType": "str", + }, + "userCreatedStorageAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + } + ], + "registryPrivateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "location": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "provisioningState": "str", + "registryPrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_remove_regions(self, resource_group): + response = await ( + await self.client.registries.begin_remove_regions( + resource_group_name=resource_group.name, + registry_name="str", + body={ + "location": "str", + "discoveryUrl": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "intellectualPropertyPublisher": "str", + "kind": "str", + "managedResourceGroup": {"resourceId": "str"}, + "managedResourceGroupSettings": {"assignedIdentities": [{"principalId": "str"}]}, + "mlFlowRegistryUri": "str", + "name": "str", + "publicNetworkAccess": "str", + "regionDetails": [ + { + "acrDetails": [ + { + "systemCreatedAcrAccount": { + "acrAccountName": "str", + "acrAccountSku": "str", + "armResourceId": {"resourceId": "str"}, + }, + "userCreatedAcrAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + "location": "str", + "storageAccountDetails": [ + { + "systemCreatedStorageAccount": { + "allowBlobPublicAccess": bool, + "armResourceId": {"resourceId": "str"}, + "storageAccountHnsEnabled": bool, + "storageAccountName": "str", + "storageAccountType": "str", + }, + "userCreatedStorageAccount": {"armResourceId": {"resourceId": "str"}}, + } + ], + } + ], + "registryPrivateEndpointConnections": [ + { + "groupIds": ["str"], + "id": "str", + "location": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "provisioningState": "str", + "registryPrivateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations.py new file mode 100644 index 00000000000..08db413a6d5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryCodeContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_code_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_code_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_code_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_code_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations_async.py new file mode 100644 index 00000000000..d0a3578be6a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryCodeContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_code_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_code_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_code_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_code_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations.py new file mode 100644 index 00000000000..7fa6dba58f7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations.py @@ -0,0 +1,111 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryCodeVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_code_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_code_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_code_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_code_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + body={ + "properties": { + "codeUri": "str", + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_get_start_pending_upload(self, resource_group): + response = self.client.registry_code_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations_async.py new file mode 100644 index 00000000000..08b156067b7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_code_versions_operations_async.py @@ -0,0 +1,116 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryCodeVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_code_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_code_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_code_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_code_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + body={ + "properties": { + "codeUri": "str", + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_get_start_pending_upload(self, resource_group): + response = await self.client.registry_code_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + code_name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations.py new file mode 100644 index 00000000000..6dbef3f139a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryComponentContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_component_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_component_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_component_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_component_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations_async.py new file mode 100644 index 00000000000..c75a3f58006 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryComponentContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_component_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_component_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_component_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_component_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations.py new file mode 100644 index 00000000000..f422d37dc2a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations.py @@ -0,0 +1,96 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryComponentVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_component_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_component_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_component_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_component_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + body={ + "properties": { + "componentSpec": {}, + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations_async.py new file mode 100644 index 00000000000..d38e6cdb978 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_component_versions_operations_async.py @@ -0,0 +1,101 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryComponentVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_component_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_component_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_component_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_component_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + component_name="str", + version="str", + body={ + "properties": { + "componentSpec": {}, + "description": "str", + "isAnonymous": False, + "isArchived": False, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations.py new file mode 100644 index 00000000000..dc06012cc23 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_data_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_data_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_data_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_data_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + body={ + "properties": { + "dataType": "str", + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations_async.py new file mode 100644 index 00000000000..8fd628cada2 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_data_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_data_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_data_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_data_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + body={ + "properties": { + "dataType": "str", + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations.py new file mode 100644 index 00000000000..84c3a590af4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations.py @@ -0,0 +1,34 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataReferencesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_blob_reference_sas(self, resource_group): + response = self.client.registry_data_references.get_blob_reference_sas( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={"assetId": "str", "blobUri": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations_async.py new file mode 100644 index 00000000000..34a934ed6d4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_references_operations_async.py @@ -0,0 +1,35 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataReferencesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_blob_reference_sas(self, resource_group): + response = await self.client.registry_data_references.get_blob_reference_sas( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={"assetId": "str", "blobUri": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations.py new file mode 100644 index 00000000000..11e05af1222 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations.py @@ -0,0 +1,103 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_data_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_data_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_data_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_data_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={ + "properties": "data_version_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_get_start_pending_upload(self, resource_group): + response = self.client.registry_data_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations_async.py new file mode 100644 index 00000000000..4748497d857 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_data_versions_operations_async.py @@ -0,0 +1,108 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryDataVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_data_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_data_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_data_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_data_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={ + "properties": "data_version_base_properties", + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_get_start_pending_upload(self, resource_group): + response = await self.client.registry_data_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations.py new file mode 100644 index 00000000000..af28447c539 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryEnvironmentContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_environment_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_environment_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_environment_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_environment_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations_async.py new file mode 100644 index 00000000000..078c0851fce --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryEnvironmentContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_environment_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_environment_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_environment_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_environment_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations.py new file mode 100644 index 00000000000..6d892e23c4a --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations.py @@ -0,0 +1,107 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryEnvironmentVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_environment_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_environment_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_environment_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_environment_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + body={ + "properties": { + "autoRebuild": "str", + "build": {"contextUri": "str", "dockerfilePath": "Dockerfile"}, + "condaFile": "str", + "description": "str", + "environmentType": "str", + "image": "str", + "inferenceConfig": { + "livenessRoute": {"path": "str", "port": 0}, + "readinessRoute": {"path": "str", "port": 0}, + "scoringRoute": {"path": "str", "port": 0}, + }, + "isAnonymous": False, + "isArchived": False, + "osType": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations_async.py new file mode 100644 index 00000000000..1bb9968669c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_environment_versions_operations_async.py @@ -0,0 +1,112 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryEnvironmentVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_environment_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_environment_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_environment_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_environment_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + environment_name="str", + version="str", + body={ + "properties": { + "autoRebuild": "str", + "build": {"contextUri": "str", "dockerfilePath": "Dockerfile"}, + "condaFile": "str", + "description": "str", + "environmentType": "str", + "image": "str", + "inferenceConfig": { + "livenessRoute": {"path": "str", "port": 0}, + "readinessRoute": {"path": "str", "port": 0}, + "scoringRoute": {"path": "str", "port": 0}, + }, + "isAnonymous": False, + "isArchived": False, + "osType": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations.py new file mode 100644 index 00000000000..8b67a5bdf24 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations.py @@ -0,0 +1,92 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryModelContainersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_model_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_model_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_model_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_model_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations_async.py new file mode 100644 index 00000000000..2b0517aa27c --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_containers_operations_async.py @@ -0,0 +1,97 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryModelContainersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_model_containers.list( + resource_group_name=resource_group.name, + registry_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_model_containers.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_model_containers.get( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_model_containers.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + body={ + "properties": { + "description": "str", + "isArchived": False, + "latestVersion": "str", + "nextVersion": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations.py new file mode 100644 index 00000000000..a8c0a04f755 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations.py @@ -0,0 +1,115 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryModelVersionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.registry_model_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.registry_model_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.registry_model_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.registry_model_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + body={ + "properties": { + "description": "str", + "flavors": {"str": {"data": {"str": "str"}}}, + "isAnonymous": False, + "isArchived": False, + "jobName": "str", + "modelType": "str", + "modelUri": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_get_start_pending_upload(self, resource_group): + response = self.client.registry_model_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations_async.py new file mode 100644 index 00000000000..2eb8f963265 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_registry_model_versions_operations_async.py @@ -0,0 +1,120 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtRegistryModelVersionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.registry_model_versions.list( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.registry_model_versions.begin_delete( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.registry_model_versions.get( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.registry_model_versions.begin_create_or_update( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + body={ + "properties": { + "description": "str", + "flavors": {"str": {"data": {"str": "str"}}}, + "isAnonymous": False, + "isArchived": False, + "jobName": "str", + "modelType": "str", + "modelUri": "str", + "properties": {"str": "str"}, + "provisioningState": "str", + "stage": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_get_start_pending_upload(self, resource_group): + response = await self.client.registry_model_versions.create_or_get_start_pending_upload( + resource_group_name=resource_group.name, + registry_name="str", + model_name="str", + version="str", + body={"pendingUploadId": "str", "pendingUploadType": "str"}, + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations.py new file mode 100644 index 00000000000..3bea327ed29 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations.py @@ -0,0 +1,93 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtSchedulesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.schedules.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.schedules.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.schedules.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.schedules.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "action": "schedule_action_base", + "trigger": "trigger_base", + "description": "str", + "displayName": "str", + "isEnabled": True, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations_async.py new file mode 100644 index 00000000000..2da6a61ebb5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_schedules_operations_async.py @@ -0,0 +1,98 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtSchedulesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.schedules.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.schedules.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.schedules.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.schedules.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "properties": { + "action": "schedule_action_base", + "trigger": "trigger_base", + "description": "str", + "displayName": "str", + "isEnabled": True, + "properties": {"str": "str"}, + "provisioningState": "str", + "tags": {"str": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations.py new file mode 100644 index 00000000000..6a9c25e0e46 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations.py @@ -0,0 +1,147 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtServerlessEndpointsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.serverless_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.serverless_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.serverless_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.serverless_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.serverless_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "contentSafety": {"contentSafetyStatus": "str"}, + "endpointState": "str", + "inferenceEndpoint": {"uri": "str", "headers": {"str": "str"}}, + "marketplaceSubscriptionId": "str", + "modelSettings": {"modelId": "str"}, + "provisioningState": "str", + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.serverless_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_regenerate_keys(self, resource_group): + response = self.client.serverless_endpoints.begin_regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={"keyType": "str", "keyValue": "str"}, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations_async.py new file mode 100644 index 00000000000..6520e04f156 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_serverless_endpoints_operations_async.py @@ -0,0 +1,156 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtServerlessEndpointsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.serverless_endpoints.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.serverless_endpoints.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.serverless_endpoints.get( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.serverless_endpoints.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "identity": {"type": "str", "userAssignedIdentities": {"str": {}}}, + "sku": {"capacity": 0, "family": "str", "name": "str", "size": "str", "tier": "str"}, + "tags": {"str": "str"}, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.serverless_endpoints.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={ + "location": "str", + "properties": { + "authMode": "str", + "contentSafety": {"contentSafetyStatus": "str"}, + "endpointState": "str", + "inferenceEndpoint": {"uri": "str", "headers": {"str": "str"}}, + "marketplaceSubscriptionId": "str", + "modelSettings": {"modelId": "str"}, + "provisioningState": "str", + }, + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "kind": "str", + "name": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.serverless_endpoints.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_regenerate_keys(self, resource_group): + response = await ( + await self.client.serverless_endpoints.begin_regenerate_keys( + resource_group_name=resource_group.name, + workspace_name="str", + name="str", + body={"keyType": "str", "keyValue": "str"}, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations.py new file mode 100644 index 00000000000..c07eb55f21e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations_async.py new file mode 100644 index 00000000000..62e41b9b72e --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_usages_operations_async.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtUsagesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.usages.list( + location="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations.py new file mode 100644 index 00000000000..2f12cb2e6ba --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtVirtualMachineSizesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.virtual_machine_sizes.list( + location="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations_async.py new file mode 100644 index 00000000000..9adb153b25b --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_virtual_machine_sizes_operations_async.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtVirtualMachineSizesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.virtual_machine_sizes.list( + location="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations.py new file mode 100644 index 00000000000..c5cd98c37a7 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations.py @@ -0,0 +1,109 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspaceConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workspace_connections.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.workspace_connections.delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workspace_connections.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.workspace_connections.update( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.workspace_connections.create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_secrets(self, resource_group): + response = self.client.workspace_connections.list_secrets( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_test_connection(self, resource_group): + response = self.client.workspace_connections.begin_test_connection( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations_async.py new file mode 100644 index 00000000000..184eb3333ab --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_connections_operations_async.py @@ -0,0 +1,112 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspaceConnectionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workspace_connections.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.workspace_connections.delete( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workspace_connections.get( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.workspace_connections.update( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.workspace_connections.create( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_secrets(self, resource_group): + response = await self.client.workspace_connections.list_secrets( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_test_connection(self, resource_group): + response = await ( + await self.client.workspace_connections.begin_test_connection( + resource_group_name=resource_group.name, + workspace_name="str", + connection_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations.py new file mode 100644 index 00000000000..782fb7df8d5 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspaceFeaturesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.workspace_features.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations_async.py new file mode 100644 index 00000000000..58d6d018cd9 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspace_features_operations_async.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspaceFeaturesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.workspace_features.list( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations.py new file mode 100644 index 00000000000..40279a6adeb --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations.py @@ -0,0 +1,364 @@ +# 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 pytest +from azure.mgmt.machinelearningservices import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.workspaces.list_by_subscription( + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.workspaces.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.workspaces.get( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.workspaces.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + body={ + "allowRoleAssignmentOnRG": bool, + "applicationInsights": "str", + "containerRegistry": "str", + "description": "str", + "enableDataIsolation": bool, + "enableSoftwareBillOfMaterials": bool, + "encryption": {"keyVaultProperties": {"keyIdentifier": "str"}}, + "featureStoreSettings": { + "computeRuntime": {"sparkRuntimeVersion": "str"}, + "offlineStoreConnectionName": "str", + "onlineStoreConnectionName": "str", + }, + "friendlyName": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "imageBuildCompute": "str", + "ipAllowlist": ["str"], + "managedNetwork": { + "changeableIsolationModes": ["str"], + "firewallSku": "str", + "isolationMode": "str", + "networkId": "str", + "outboundRules": {"str": "outbound_rule"}, + "status": {"sparkReady": bool, "status": "str"}, + }, + "networkAcls": {"defaultAction": "str", "ipRules": [{"value": "str"}]}, + "primaryUserAssignedIdentity": "str", + "publicNetworkAccess": "str", + "serverlessComputeSettings": { + "serverlessComputeCustomSubnet": "str", + "serverlessComputeNoPublicIP": bool, + }, + "serviceManagedResourcesSettings": {"cosmosDb": {"collectionsThroughput": 0}}, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "softDeleteRetentionInDays": 0, + "systemDatastoresAuthMode": "str", + "tags": {"str": "str"}, + "v1LegacyMode": bool, + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.workspaces.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + body={ + "agentsEndpointUri": "str", + "allowPublicAccessWhenBehindVnet": bool, + "allowRoleAssignmentOnRG": bool, + "applicationInsights": "str", + "associatedWorkspaces": ["str"], + "containerRegistries": ["str"], + "containerRegistry": "str", + "description": "str", + "discoveryUrl": "str", + "enableDataIsolation": bool, + "enableServiceSideCMKEncryption": bool, + "enableSimplifiedCmk": bool, + "enableSoftwareBillOfMaterials": bool, + "encryption": { + "keyVaultProperties": {"keyIdentifier": "str", "keyVaultArmId": "str", "identityClientId": "str"}, + "status": "str", + "cosmosDbResourceId": "str", + "identity": {"userAssignedIdentity": "str"}, + "searchAccountResourceId": "str", + "storageAccountResourceId": "str", + }, + "existingWorkspaces": ["str"], + "featureStoreSettings": { + "computeRuntime": {"sparkRuntimeVersion": "str"}, + "offlineStoreConnectionName": "str", + "onlineStoreConnectionName": "str", + }, + "friendlyName": "str", + "hbiWorkspace": bool, + "hubResourceId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "imageBuildCompute": "str", + "ipAllowlist": ["str"], + "keyVault": "str", + "keyVaults": ["str"], + "kind": "str", + "location": "str", + "managedNetwork": { + "changeableIsolationModes": ["str"], + "firewallSku": "str", + "isolationMode": "str", + "networkId": "str", + "outboundRules": {"str": "outbound_rule"}, + "status": {"sparkReady": bool, "status": "str"}, + }, + "mlFlowTrackingUri": "str", + "name": "str", + "networkAcls": {"defaultAction": "str", "ipRules": [{"value": "str"}]}, + "notebookInfo": { + "fqdn": "str", + "isPrivateLinkEnabled": bool, + "notebookPreparationError": {"errorMessage": "str", "statusCode": 0}, + "resourceId": "str", + }, + "primaryUserAssignedIdentity": "str", + "privateEndpointConnections": [ + { + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "privateLinkCount": 0, + "provisionNetworkNow": bool, + "provisioningState": "str", + "publicNetworkAccess": "str", + "serverlessComputeSettings": { + "serverlessComputeCustomSubnet": "str", + "serverlessComputeNoPublicIP": bool, + }, + "serviceManagedResourcesSettings": {"cosmosDb": {"collectionsThroughput": 0}}, + "serviceProvisionedResourceGroup": "str", + "sharedPrivateLinkResources": [ + { + "groupId": "str", + "name": "str", + "privateLinkResourceId": "str", + "requestMessage": "str", + "status": "str", + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "softDeleteRetentionInDays": 0, + "storageAccount": "str", + "storageAccounts": ["str"], + "storageHnsEnabled": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "systemDatastoresAuthMode": "str", + "tags": {"str": "str"}, + "tenantId": "str", + "type": "str", + "v1LegacyMode": bool, + "workspaceHubConfig": { + "additionalWorkspaceStorageAccounts": ["str"], + "defaultWorkspaceResourceGroup": "str", + }, + "workspaceId": "str", + }, + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_diagnose(self, resource_group): + response = self.client.workspaces.begin_diagnose( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_keys(self, resource_group): + response = self.client.workspaces.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_notebook_access_token(self, resource_group): + response = self.client.workspaces.list_notebook_access_token( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_notebook_keys(self, resource_group): + response = self.client.workspaces.list_notebook_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_storage_account_keys(self, resource_group): + response = self.client.workspaces.list_storage_account_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_outbound_network_dependencies_endpoints(self, resource_group): + response = self.client.workspaces.list_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_prepare_notebook(self, resource_group): + response = self.client.workspaces.begin_prepare_notebook( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_resync_keys(self, resource_group): + response = self.client.workspaces.begin_resync_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations_async.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations_async.py new file mode 100644 index 00000000000..749e7da3bd4 --- /dev/null +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/generated_tests/test_machine_learning_services_mgmt_workspaces_operations_async.py @@ -0,0 +1,381 @@ +# 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 pytest +from azure.mgmt.machinelearningservices.aio import MachineLearningServicesMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMachineLearningServicesMgmtWorkspacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MachineLearningServicesMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.workspaces.list_by_subscription( + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-10-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.workspaces.begin_delete( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.workspaces.get( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.workspaces.begin_update( + resource_group_name=resource_group.name, + workspace_name="str", + body={ + "allowRoleAssignmentOnRG": bool, + "applicationInsights": "str", + "containerRegistry": "str", + "description": "str", + "enableDataIsolation": bool, + "enableSoftwareBillOfMaterials": bool, + "encryption": {"keyVaultProperties": {"keyIdentifier": "str"}}, + "featureStoreSettings": { + "computeRuntime": {"sparkRuntimeVersion": "str"}, + "offlineStoreConnectionName": "str", + "onlineStoreConnectionName": "str", + }, + "friendlyName": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "imageBuildCompute": "str", + "ipAllowlist": ["str"], + "managedNetwork": { + "changeableIsolationModes": ["str"], + "firewallSku": "str", + "isolationMode": "str", + "networkId": "str", + "outboundRules": {"str": "outbound_rule"}, + "status": {"sparkReady": bool, "status": "str"}, + }, + "networkAcls": {"defaultAction": "str", "ipRules": [{"value": "str"}]}, + "primaryUserAssignedIdentity": "str", + "publicNetworkAccess": "str", + "serverlessComputeSettings": { + "serverlessComputeCustomSubnet": "str", + "serverlessComputeNoPublicIP": bool, + }, + "serviceManagedResourcesSettings": {"cosmosDb": {"collectionsThroughput": 0}}, + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "softDeleteRetentionInDays": 0, + "systemDatastoresAuthMode": "str", + "tags": {"str": "str"}, + "v1LegacyMode": bool, + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.workspaces.begin_create_or_update( + resource_group_name=resource_group.name, + workspace_name="str", + body={ + "agentsEndpointUri": "str", + "allowPublicAccessWhenBehindVnet": bool, + "allowRoleAssignmentOnRG": bool, + "applicationInsights": "str", + "associatedWorkspaces": ["str"], + "containerRegistries": ["str"], + "containerRegistry": "str", + "description": "str", + "discoveryUrl": "str", + "enableDataIsolation": bool, + "enableServiceSideCMKEncryption": bool, + "enableSimplifiedCmk": bool, + "enableSoftwareBillOfMaterials": bool, + "encryption": { + "keyVaultProperties": { + "keyIdentifier": "str", + "keyVaultArmId": "str", + "identityClientId": "str", + }, + "status": "str", + "cosmosDbResourceId": "str", + "identity": {"userAssignedIdentity": "str"}, + "searchAccountResourceId": "str", + "storageAccountResourceId": "str", + }, + "existingWorkspaces": ["str"], + "featureStoreSettings": { + "computeRuntime": {"sparkRuntimeVersion": "str"}, + "offlineStoreConnectionName": "str", + "onlineStoreConnectionName": "str", + }, + "friendlyName": "str", + "hbiWorkspace": bool, + "hubResourceId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "imageBuildCompute": "str", + "ipAllowlist": ["str"], + "keyVault": "str", + "keyVaults": ["str"], + "kind": "str", + "location": "str", + "managedNetwork": { + "changeableIsolationModes": ["str"], + "firewallSku": "str", + "isolationMode": "str", + "networkId": "str", + "outboundRules": {"str": "outbound_rule"}, + "status": {"sparkReady": bool, "status": "str"}, + }, + "mlFlowTrackingUri": "str", + "name": "str", + "networkAcls": {"defaultAction": "str", "ipRules": [{"value": "str"}]}, + "notebookInfo": { + "fqdn": "str", + "isPrivateLinkEnabled": bool, + "notebookPreparationError": {"errorMessage": "str", "statusCode": 0}, + "resourceId": "str", + }, + "primaryUserAssignedIdentity": "str", + "privateEndpointConnections": [ + { + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "privateEndpoint": {"id": "str", "subnetArmId": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + } + ], + "privateLinkCount": 0, + "provisionNetworkNow": bool, + "provisioningState": "str", + "publicNetworkAccess": "str", + "serverlessComputeSettings": { + "serverlessComputeCustomSubnet": "str", + "serverlessComputeNoPublicIP": bool, + }, + "serviceManagedResourcesSettings": {"cosmosDb": {"collectionsThroughput": 0}}, + "serviceProvisionedResourceGroup": "str", + "sharedPrivateLinkResources": [ + { + "groupId": "str", + "name": "str", + "privateLinkResourceId": "str", + "requestMessage": "str", + "status": "str", + } + ], + "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, + "softDeleteRetentionInDays": 0, + "storageAccount": "str", + "storageAccounts": ["str"], + "storageHnsEnabled": bool, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "systemDatastoresAuthMode": "str", + "tags": {"str": "str"}, + "tenantId": "str", + "type": "str", + "v1LegacyMode": bool, + "workspaceHubConfig": { + "additionalWorkspaceStorageAccounts": ["str"], + "defaultWorkspaceResourceGroup": "str", + }, + "workspaceId": "str", + }, + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_diagnose(self, resource_group): + response = await ( + await self.client.workspaces.begin_diagnose( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_keys(self, resource_group): + response = await self.client.workspaces.list_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_notebook_access_token(self, resource_group): + response = await self.client.workspaces.list_notebook_access_token( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_notebook_keys(self, resource_group): + response = await self.client.workspaces.list_notebook_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_storage_account_keys(self, resource_group): + response = await self.client.workspaces.list_storage_account_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_outbound_network_dependencies_endpoints(self, resource_group): + response = await self.client.workspaces.list_outbound_network_dependencies_endpoints( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_prepare_notebook(self, resource_group): + response = await ( + await self.client.workspaces.begin_prepare_notebook( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_resync_keys(self, resource_group): + response = await ( + await self.client.workspaces.begin_resync_keys( + resource_group_name=resource_group.name, + workspace_name="str", + api_version="2024-10-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/machinelearning/azure-mgmt-machinelearningservices/setup.py b/sdk/machinelearning/azure-mgmt-machinelearningservices/setup.py index 4be603c3461..b801edcc8d2 100644 --- a/sdk/machinelearning/azure-mgmt-machinelearningservices/setup.py +++ b/sdk/machinelearning/azure-mgmt-machinelearningservices/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,68 @@ PACKAGE_PPRINT_NAME = "Machine Learning Services Management" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7" + python_requires=">=3.8", )